#2641 - toString() - addCollection() firstElement change

This commit is contained in:
Rob Bygrave
2022-04-08 22:30:00 +12:00
parent 183b601be8
commit be2466003d
2 changed files with 32 additions and 2 deletions
@@ -125,10 +125,12 @@ public final class ToStringBuilder {
sb.append("[]");
return;
}
int collectionPos = 0;
boolean firstElement = true;
sb.append("[");
for (Object o : c) {
if (collectionPos++ > 0) {
if (firstElement) {
firstElement = false;
} else {
sb.append(", ");
}
value(o);