Package org.eclipse.emf.common.util
Class SegmentSequence.Builder
java.lang.Object
org.eclipse.emf.common.util.SegmentSequence.Builder
- Enclosing class:
- SegmentSequence
A builder for creating a
composed string or a toSegmentSequence().
It may be a more efficient alternative to StringBuilder because the strings are not copied to a character-based buffer until toString() is called.
At that time, the total number of characters needed is known, so a character array can be allocated and used direct to create a string.
Using the empty string as the delimiter is particularly useful for that purpose.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) Appends a string representation of the character to the builder and returns the builder itself.Appends a string to the builder and returns the builder itself.reverse()Reverses the strings in the builder and returns the builder itself.Converts the builder to a corresponding segment sequence.toString()Converts the builder to a string representation, i.e,.
-
Field Details
-
delimiter
The delimiter of the builder. -
size
protected int sizeThe number of strings in the builder. -
strings
The string sin the builder.
-
-
Constructor Details
-
Builder
Creates an instance with the given capacity.
-
-
Method Details
-
append
Appends a string to the builder and returns the builder itself. -
append
Appends a string representation of the character to the builder and returns the builder itself. -
reverse
Reverses the strings in the builder and returns the builder itself. -
toSegmentSequence
Converts the builder to a corresponding segment sequence. -
toString
Converts the builder to a string representation, i.e,. the delimiter-separated composition of the appended strings.
-