Package org.faktorips.runtime.util
Class StringBuilderJoiner
java.lang.Object
org.faktorips.runtime.util.StringBuilderJoiner
Utility class similar to
StringJoiner
/ String.join(CharSequence, Iterable)
/
Collectors.joining(CharSequence)
that does not create intermediary Strings but appends
all parts to a preexisting StringBuilder
.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic final void
join
(StringBuilder sb, Iterable<?> iterable) Appends the elements of the providedIterable
to the givenStringBuilder
, separated by theDEFAULT_SEPARATOR
", ".static final void
join
(StringBuilder sb, Iterable<?> iterable, String separator) Appends the elements of the providedIterable
to the givenStringBuilder
, separated by the given separator.static final <T> void
join
(StringBuilder sb, Iterable<T> iterable, String separator, Consumer<? super T> singleItemAppender) Appends the elements of the providedIterable
, converted to String with the giventoString
Function
, to the givenStringBuilder
, separated by the given separator.static final <T> void
join
(StringBuilder sb, Iterable<T> iterable, Consumer<? super T> singleItemAppender) Appends the elements of the providedIterable
, converted to String with the giventoString
Function
, to the givenStringBuilder
, separated by theDEFAULT_SEPARATOR
", ".static final void
join
(StringBuilder sb, Object[] objectArray) Appends the elements of the provided array to the givenStringBuilder
, separated by theDEFAULT_SEPARATOR
", ".static final <T> void
join
(StringBuilder sb, T[] objectArray, Consumer<? super T> singleItemAppender) Appends the elements of the provided array, converted to String with the giventoString
Function
, to the givenStringBuilder
, separated by theDEFAULT_SEPARATOR
", ".
-
Field Details
-
DEFAULT_SEPARATOR
- See Also:
-
-
Method Details
-
join
Appends the elements of the providedIterable
to the givenStringBuilder
, separated by the given separator. No delimiter is added before or after the list.- Parameters:
sb
- theStringBuilder
to which the values will be appendediterable
- the Collection of values to join together, may benull
separator
- the separator to use, null treated as ""
-
join
Appends the elements of the providedIterable
to the givenStringBuilder
, separated by theDEFAULT_SEPARATOR
", ". No delimiter is added before or after the list.- Parameters:
sb
- theStringBuilder
to which the values will be appendediterable
- the Collection of values to join together, may benull
-
join
Appends the elements of the provided array to the givenStringBuilder
, separated by theDEFAULT_SEPARATOR
", ". No delimiter is added before or after the list.- Parameters:
sb
- theStringBuilder
to which the values will be appendedobjectArray
- the array of values to join together, may benull
-
join
public static final <T> void join(StringBuilder sb, Iterable<T> iterable, Consumer<? super T> singleItemAppender) Appends the elements of the providedIterable
, converted to String with the giventoString
Function
, to the givenStringBuilder
, separated by theDEFAULT_SEPARATOR
", ". No delimiter is added before or after the list.- Parameters:
sb
- theStringBuilder
to which the values will be appendediterable
- the Collection of values to join together, may benull
singleItemAppender
- aConsumer
that takes a single element to append it with multiple calls toStringBuilder.append(String)
-
join
public static final <T> void join(StringBuilder sb, T[] objectArray, Consumer<? super T> singleItemAppender) Appends the elements of the provided array, converted to String with the giventoString
Function
, to the givenStringBuilder
, separated by theDEFAULT_SEPARATOR
", ". No delimiter is added before or after the list.- Parameters:
sb
- theStringBuilder
to which the values will be appendedobjectArray
- the array of values to join together, may benull
singleItemAppender
- aConsumer
that takes a single element to append it with multiple calls toStringBuilder.append(String)
-
join
public static final <T> void join(StringBuilder sb, Iterable<T> iterable, String separator, Consumer<? super T> singleItemAppender) Appends the elements of the providedIterable
, converted to String with the giventoString
Function
, to the givenStringBuilder
, separated by the given separator. No delimiter is added before or after the list.- Parameters:
sb
- theStringBuilder
to which the values will be appendediterable
- the Collection of values to join together, may benull
separator
- the separator to use, null treated as ""singleItemAppender
- aConsumer
that takes a single element to append it with multiple calls toStringBuilder.append(String)
-