Top Description Fields Constructors Methods
com.github.javaparser.utils

public Class SeparatedItemStringBuilder

extends Object
Class Inheritance

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.

Field Summary

Modifier and TypeField and Description
private StringBuilder
private boolean
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
SeparatedItemStringBuilder(String prefix, String separator, String postfix)

Method Summary

Modifier and TypeMethod and Description
public SeparatedItemStringBuilder
append(CharSequence format, Object... args)

Add one item.

public boolean
public String
toString()

Overrides java.lang.Object.toString.

Convert the builder into its final string representation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

builderback to summary
private StringBuilder builder
hasItemsback to summary
private boolean hasItems
postfixback to summary
private final String postfix
separatorback to summary
private final String separator

Constructor Detail

SeparatedItemStringBuilderback to summary
public SeparatedItemStringBuilder(String prefix, String separator, String postfix)

Method Detail

appendback to summary
public SeparatedItemStringBuilder append(CharSequence format, Object... args)

Add one item. Either pass a string, or a format for String.format and corresponding arguments.

hasItemsback to summary
public boolean hasItems()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Convert the builder into its final string representation.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

Annotations
@Override