Package org.faktorips.runtime.util
Class StringBuilderJoiner
- java.lang.Object
-
- org.faktorips.runtime.util.StringBuilderJoiner
-
public class StringBuilderJoiner extends java.lang.ObjectUtility class similar toStringJoiner/String.join(CharSequence, Iterable)/Collectors.joining(CharSequence)that does not create intermediary Strings but appends all parts to a preexistingStringBuilder.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_SEPARATOR
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidjoin(java.lang.StringBuilder sb, java.lang.Iterable<?> iterable)Appends the elements of the providedIterableto the givenStringBuilder, separated by theDEFAULT_SEPARATOR", ".static voidjoin(java.lang.StringBuilder sb, java.lang.Iterable<?> iterable, java.lang.String separator)Appends the elements of the providedIterableto the givenStringBuilder, separated by the given separator.static <T> voidjoin(java.lang.StringBuilder sb, java.lang.Iterable<T> iterable, java.lang.String separator, java.util.function.Consumer<? super T> singleItemAppender)Appends the elements of the providedIterable, converted to String with the giventoStringFunction, to the givenStringBuilder, separated by the given separator.static <T> voidjoin(java.lang.StringBuilder sb, java.lang.Iterable<T> iterable, java.util.function.Consumer<? super T> singleItemAppender)Appends the elements of the providedIterable, converted to String with the giventoStringFunction, to the givenStringBuilder, separated by theDEFAULT_SEPARATOR", ".static voidjoin(java.lang.StringBuilder sb, java.lang.Object[] objectArray)Appends the elements of the provided array to the givenStringBuilder, separated by theDEFAULT_SEPARATOR", ".static <T> voidjoin(java.lang.StringBuilder sb, T[] objectArray, java.util.function.Consumer<? super T> singleItemAppender)Appends the elements of the provided array, converted to String with the giventoStringFunction, to the givenStringBuilder, separated by theDEFAULT_SEPARATOR", ".
-
-
-
Field Detail
-
DEFAULT_SEPARATOR
public static final java.lang.String DEFAULT_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
join
public static final void join(java.lang.StringBuilder sb, java.lang.Iterable<?> iterable, java.lang.String separator)Appends the elements of the providedIterableto the givenStringBuilder, separated by the given separator. No delimiter is added before or after the list.- Parameters:
sb- theStringBuilderto which the values will be appendediterable- the Collection of values to join together, may benullseparator- the separator to use, null treated as ""
-
join
public static final void join(java.lang.StringBuilder sb, java.lang.Iterable<?> iterable)Appends the elements of the providedIterableto the givenStringBuilder, separated by theDEFAULT_SEPARATOR", ". No delimiter is added before or after the list.- Parameters:
sb- theStringBuilderto which the values will be appendediterable- the Collection of values to join together, may benull
-
join
public static final void join(java.lang.StringBuilder sb, java.lang.Object[] objectArray)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- theStringBuilderto which the values will be appendedobjectArray- the array of values to join together, may benull
-
join
public static final <T> void join(java.lang.StringBuilder sb, java.lang.Iterable<T> iterable, java.util.function.Consumer<? super T> singleItemAppender)Appends the elements of the providedIterable, converted to String with the giventoStringFunction, to the givenStringBuilder, separated by theDEFAULT_SEPARATOR", ". No delimiter is added before or after the list.- Parameters:
sb- theStringBuilderto which the values will be appendediterable- the Collection of values to join together, may benullsingleItemAppender- aConsumerthat takes a single element to append it with multiple calls toStringBuilder.append(String)
-
join
public static final <T> void join(java.lang.StringBuilder sb, T[] objectArray, java.util.function.Consumer<? super T> singleItemAppender)Appends the elements of the provided array, converted to String with the giventoStringFunction, to the givenStringBuilder, separated by theDEFAULT_SEPARATOR", ". No delimiter is added before or after the list.- Parameters:
sb- theStringBuilderto which the values will be appendedobjectArray- the array of values to join together, may benullsingleItemAppender- aConsumerthat takes a single element to append it with multiple calls toStringBuilder.append(String)
-
join
public static final <T> void join(java.lang.StringBuilder sb, java.lang.Iterable<T> iterable, java.lang.String separator, java.util.function.Consumer<? super T> singleItemAppender)Appends the elements of the providedIterable, converted to String with the giventoStringFunction, to the givenStringBuilder, separated by the given separator. No delimiter is added before or after the list.- Parameters:
sb- theStringBuilderto which the values will be appendediterable- the Collection of values to join together, may benullseparator- the separator to use, null treated as ""singleItemAppender- aConsumerthat takes a single element to append it with multiple calls toStringBuilder.append(String)
-
-