Skip to content

Commit

Permalink
PDFBOX-5660: use StringJoiner
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1921712 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
THausherr committed Oct 31, 2024
1 parent c3bb464 commit 9926bad
Showing 1 changed file with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure;

import java.util.StringJoiner;

import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
Expand Down Expand Up @@ -202,16 +204,12 @@ public String toString()
*/
protected static String arrayToString(Object[] array)
{
StringBuilder sb = new StringBuilder("[");
for (int i = 0; i < array.length; i++)
StringJoiner sj = new StringJoiner(", ", "[", "]");
for (Object o : array)
{
if (i > 0)
{
sb.append(", ");
}
sb.append(array[i]);
sj.add(o.toString());
}
return sb.append(']').toString();
return sj.toString();
}

/**
Expand All @@ -222,16 +220,12 @@ protected static String arrayToString(Object[] array)
*/
protected static String arrayToString(float[] array)
{
StringBuilder sb = new StringBuilder("[");
for (int i = 0; i < array.length; i++)
StringJoiner sj = new StringJoiner(", ", "[", "]");
for (float f : array)
{
if (i > 0)
{
sb.append(", ");
}
sb.append(array[i]);
sj.add(Float.toString(f));
}
return sb.append(']').toString();
return sj.toString();
}

}

0 comments on commit 9926bad

Please sign in to comment.