Package com.helger.commons.string
Class StringHelper.ImploderBuilder
- java.lang.Object
-
- com.helger.commons.string.StringHelper.ImploderBuilder
-
- Enclosing class:
- StringHelper
public static class StringHelper.ImploderBuilder extends Object implements IBuilder<String>
A simple builder that allows to implode collections of arguments with a lot of customization. It used by all the "getImploded*" overloads and fulfills the requests of other use cases as well.- Since:
- 10.0.0
- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description ImploderBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringbuild()Build the objectStringHelper.ImploderBuilderfilter(Predicate<String> a)StringHelper.ImploderBuilderfilterNonEmpty()StringHelper.ImploderBuilderlength(int n)Set the number of source items to iterate, depending on the source offset.StringHelper.ImploderBuilderoffset(int n)Set an offset of the source from which to start.StringHelper.ImploderBuilderseparator(char c)StringHelper.ImploderBuilderseparator(String s)StringHelper.ImploderBuildersource(Iterable<?> a)<T> StringHelper.ImploderBuildersource(Iterable<T> a, Function<? super T,String> aMapper)StringHelper.ImploderBuildersource(String... a)<T> StringHelper.ImploderBuildersource(T... a)<T> StringHelper.ImploderBuildersource(T[] a, Function<? super T,String> aMapper)
-
-
-
Method Detail
-
source
@Nonnull public StringHelper.ImploderBuilder source(@Nullable Iterable<?> a)
-
source
@Nonnull public <T> StringHelper.ImploderBuilder source(@Nullable Iterable<T> a, @Nonnull Function<? super T,String> aMapper)
-
source
@Nonnull public StringHelper.ImploderBuilder source(@Nullable String... a)
-
source
@Nonnull @SafeVarargs public final <T> StringHelper.ImploderBuilder source(@Nullable T... a)
-
source
@Nonnull public <T> StringHelper.ImploderBuilder source(@Nullable T[] a, @Nonnull Function<? super T,String> aMapper)
-
separator
@Nonnull public StringHelper.ImploderBuilder separator(char c)
-
separator
@Nonnull public StringHelper.ImploderBuilder separator(@Nullable String s)
-
offset
@Nonnull public StringHelper.ImploderBuilder offset(int n)
Set an offset of the source from which to start. Only values > 0 have an effect.- Parameters:
n- The offset to use- Returns:
- this for chaining
-
length
@Nonnull public StringHelper.ImploderBuilder length(int n)
Set the number of source items to iterate, depending on the source offset. By default all elements from start to end are used. Only values > 0 have an effect.- Parameters:
n- The length to use- Returns:
- this for chaining
-
filterNonEmpty
@Nonnull public StringHelper.ImploderBuilder filterNonEmpty()
-
filter
@Nonnull public StringHelper.ImploderBuilder filter(@Nullable Predicate<String> a)
-
-