/** * Given a set of {@code objects}, calls {@code toString} on each of them with the {@code builder} * and separates each object's output in the {@code builder} with a comma. */ public static void toStrings(TextBuilder builder, Iterable<?> objects) { boolean first = true; for (Object object : objects) { if (!first) { builder.append(", "); } builder.append(object.toString()); first = false; } }
/** * Given a set of {@code objects}, calls {@code toCompactString} on each of them with the {@code * builder} and separates each object's output in the {@code builder} with a comma. */ public static void toCompactStrings( TextBuilder builder, Iterable<? extends InternalBase> objects) { boolean first = true; for (InternalBase object : objects) { if (!first) { builder.append(", "); } object.toCompactString(builder); first = false; } }