Package com.github.javaparser.utils
Class SeparatedItemStringBuilder
- java.lang.Object
-
- com.github.javaparser.utils.SeparatedItemStringBuilder
-
public class SeparatedItemStringBuilder extends Object
Builds a string containing a list of items with a prefix, a postfix, and a separator.
Example: (1,2,3) which has prefix "(", separator ",", postfix ")" and the items 1 through 3. Java 8 offers the very nice Collectors.joining(String, String, String) which does the same thing.
-
-
Constructor Summary
Constructors Constructor Description SeparatedItemStringBuilder(String prefix, String separator, String postfix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SeparatedItemStringBuilderappend(CharSequence format, Object... args)Add one item.booleanhasItems()StringtoString()Convert the builder into its final string representation.
-
-
-
Method Detail
-
append
public SeparatedItemStringBuilder append(CharSequence format, Object... args)
Add one item. Either pass a string, or a format for String.format and corresponding arguments.
-
hasItems
public boolean hasItems()
-
-