Package com.github.javaparser.utils
Class SeparatedItemStringBuilder
- java.lang.Object
-
- com.github.javaparser.utils.SeparatedItemStringBuilder
-
public class SeparatedItemStringBuilder extends java.lang.ObjectBuilds 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(java.lang.String prefix, java.lang.String separator, java.lang.String postfix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SeparatedItemStringBuilderappend(java.lang.CharSequence format, java.lang.Object... args)Add one item.booleanhasItems()java.lang.StringtoString()Convert the builder into its final string representation.
-
-
-
Method Detail
-
append
public SeparatedItemStringBuilder append(java.lang.CharSequence format, java.lang.Object... args)
Add one item. Either pass a string, or a format for String.format and corresponding arguments.
-
hasItems
public boolean hasItems()
-
toString
public java.lang.String toString()
Convert the builder into its final string representation.- Overrides:
toStringin classjava.lang.Object
-
-