Class StringImplode

java.lang.Object
com.helger.base.string.StringImplode

@Immutable public final class StringImplode extends Object
Helper class for joining (imploding) collections and arrays into a single string with a configurable separator.
Author:
Philip Helger
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A simple builder that allows to implode collections of arguments with a lot of customization.
    static class 
    A simple builder that allows to implode maps of arguments with a lot of customization.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <KEYTYPE, VALUETYPE>
    @NonNull String
    getImploded(char cSepOuter, char cSepInner, @Nullable Map<KEYTYPE,VALUETYPE> aElements)
    Get a concatenated String from all elements of the passed map, separated by the specified separator chars.
    static <ELEMENTTYPE>
    @NonNull String
    getImploded(char cSep, @Nullable ELEMENTTYPE... aElements)
    Get a concatenated String from all elements of the passed array, separated by the specified separator char.
    static <ELEMENTTYPE>
    @NonNull String
    getImploded(char cSep, @Nullable ELEMENTTYPE[] aElements, int nOfs, int nLen)
    Get a concatenated String from all elements of the passed array, separated by the specified separator char.
    static @NonNull String
    getImploded(char cSep, @Nullable Collection<?> aElements)
    Get a concatenated String from all elements of the passed container, separated by the specified separator char.
    static <ELEMENTTYPE>
    @NonNull String
    getImploded(@Nullable ELEMENTTYPE... aElements)
    Get a concatenated String from all elements of the passed array, without a separator.
    static <ELEMENTTYPE>
    @NonNull String
    getImploded(@Nullable ELEMENTTYPE[] aElements, int nOfs, int nLen)
    Get a concatenated String from all elements of the passed array, without a separator.
    static <ELEMENTTYPE>
    @NonNull String
    getImploded(@NonNull String sSep, @Nullable ELEMENTTYPE... aElements)
    Get a concatenated String from all elements of the passed array, separated by the specified separator string.
    static <ELEMENTTYPE>
    @NonNull String
    getImploded(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, int nOfs, int nLen)
    Get a concatenated String from all elements of the passed array, separated by the specified separator string.
    static <KEYTYPE, VALUETYPE>
    @NonNull String
    getImploded(@NonNull String sSepOuter, @NonNull String sSepInner, @Nullable Map<KEYTYPE,VALUETYPE> aElements)
    Get a concatenated String from all elements of the passed map, separated by the specified separator strings.
    static @NonNull String
    getImploded(@NonNull String sSep, @Nullable Collection<?> aElements)
    Get a concatenated String from all elements of the passed container, separated by the specified separator string.
    static @NonNull String
    getImploded(@Nullable Collection<?> aElements)
    Get a concatenated String from all elements of the passed container, without a separator.
    static <KEYTYPE, VALUETYPE>
    @NonNull String
    getImplodedMapped(char cSepOuter, char cSepInner, @Nullable Map<? extends KEYTYPE,? extends VALUETYPE> aElements, @NonNull Function<? super KEYTYPE,String> aKeyMapper, @NonNull Function<? super VALUETYPE,String> aValueMapper)
    Get a concatenated String from all elements of the passed map, separated by the specified separator chars.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMapped(char cSep, @Nullable ELEMENTTYPE[] aElements, int nOfs, int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, separated by the specified separator char.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMapped(char cSep, @Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, separated by the specified separator char.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMapped(char cSep, @Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed container, separated by the specified separator char.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMapped(@Nullable ELEMENTTYPE[] aElements, int nOfs, int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, without a separator.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMapped(@Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, without a separator.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMapped(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, int nOfs, int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, separated by the specified separator string.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMapped(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, separated by the specified separator string.
    static <KEYTYPE, VALUETYPE>
    @NonNull String
    getImplodedMapped(@NonNull String sSepOuter, @NonNull String sSepInner, @Nullable Map<? extends KEYTYPE,? extends VALUETYPE> aElements, @NonNull Function<? super KEYTYPE,String> aKeyMapper, @NonNull Function<? super VALUETYPE,String> aValueMapper)
    Get a concatenated String from all elements of the passed map, separated by the specified separator strings.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMapped(@NonNull String sSep, @Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed container, separated by the specified separator string.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMapped(@Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed container, without a separator.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMappedNonEmpty(char cSep, @Nullable ELEMENTTYPE[] aElements, int nOfs, int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, separated by the specified separator char.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMappedNonEmpty(char cSep, @Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, separated by the specified separator char.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMappedNonEmpty(char cSep, @Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all non-null and non empty elements of the passed container, separated by the specified separator char.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMappedNonEmpty(@Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all non-null and non empty elements of the passed container without a separator string.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMappedNonEmpty(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, int nOfs, int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, separated by the specified separator string.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMappedNonEmpty(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all elements of the passed array, separated by the specified separator string.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMappedNonEmpty(@NonNull String sSep, @Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all non-null and non empty elements of the passed container, separated by the specified separator string.
    static <ELEMENTTYPE>
    @NonNull String
    getImplodedMappedNonEmpty(@Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
    Get a concatenated String from all non-null and non empty elements of the passed container without a separator string.
    static @NonNull String
    getImplodedNonEmpty(char cSep, @Nullable String... aElements)
    Get a concatenated String from all elements of the passed array, separated by the specified separator char.
    static @NonNull String
    getImplodedNonEmpty(char cSep, @Nullable String[] aElements, int nOfs, int nLen)
    Get a concatenated String from all elements of the passed array, separated by the specified separator char.
    static @NonNull String
    getImplodedNonEmpty(char cSep, @Nullable Collection<String> aElements)
    Get a concatenated String from all non-null and non empty elements of the passed container, separated by the specified separator char.
    static @NonNull String
    getImplodedNonEmpty(@NonNull String sSep, @Nullable String... aElements)
    Get a concatenated String from all elements of the passed array, separated by the specified separator string.
    static @NonNull String
    getImplodedNonEmpty(@NonNull String sSep, @Nullable String[] aElements, int nOfs, int nLen)
    Get a concatenated String from all elements of the passed array, separated by the specified separator string.
    static @NonNull String
    getImplodedNonEmpty(@NonNull String sSep, @Nullable Collection<String> aElements)
    Get a concatenated String from all non-null and non empty elements of the passed container, separated by the specified separator string.
    static @NonNull String
    getImplodedNonEmpty(@Nullable Collection<String> aElements)
    Get a concatenated String from all non-null and non empty elements of the passed container without a separator string.
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • imploder

      public static @NonNull StringImplode.ImploderBuilder imploder()
      Returns:
      A new StringImplode.ImploderBuilder.
      Since:
      10.0.0
    • getImploded

      public static @NonNull String getImploded(@Nullable Collection<?> aElements)
      Get a concatenated String from all elements of the passed container, without a separator. Even null elements are added.
      Parameters:
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImplodedMapped

      public static <ELEMENTTYPE> @NonNull String getImplodedMapped(@Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed container, without a separator. Even null elements are added.
      Type Parameters:
      ELEMENTTYPE - Iterable element type
      Parameters:
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImploded

      public static @NonNull String getImploded(@NonNull String sSep, @Nullable Collection<?> aElements)
      Get a concatenated String from all elements of the passed container, separated by the specified separator string. Even null elements are added.
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImploded

      public static @NonNull String getImploded(char cSep, @Nullable Collection<?> aElements)
      Get a concatenated String from all elements of the passed container, separated by the specified separator char. Even null elements are added.
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImplodedMapped

      public static <ELEMENTTYPE> @NonNull String getImplodedMapped(@NonNull String sSep, @Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed container, separated by the specified separator string. Even null elements are added.
      Type Parameters:
      ELEMENTTYPE - The element type of the collection to be imploded
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMapped

      public static <ELEMENTTYPE> @NonNull String getImplodedMapped(char cSep, @Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed container, separated by the specified separator char. Even null elements are added.
      Type Parameters:
      ELEMENTTYPE - The element type of the collection to be imploded
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImploded

      @SafeVarargs public static <ELEMENTTYPE> @NonNull String getImploded(@Nullable ELEMENTTYPE... aElements)
      Get a concatenated String from all elements of the passed array, without a separator.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImploded

      public static <ELEMENTTYPE> @NonNull String getImploded(@Nullable ELEMENTTYPE[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen)
      Get a concatenated String from all elements of the passed array, without a separator.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      Returns:
      The concatenated string.
    • getImplodedMapped

      public static <ELEMENTTYPE> @NonNull String getImplodedMapped(@Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, without a separator.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMapped

      public static <ELEMENTTYPE> @NonNull String getImplodedMapped(@Nullable ELEMENTTYPE[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, without a separator.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImploded

      @SafeVarargs public static <ELEMENTTYPE> @NonNull String getImploded(@NonNull String sSep, @Nullable ELEMENTTYPE... aElements)
      Get a concatenated String from all elements of the passed array, separated by the specified separator string.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImploded

      @SafeVarargs public static <ELEMENTTYPE> @NonNull String getImploded(char cSep, @Nullable ELEMENTTYPE... aElements)
      Get a concatenated String from all elements of the passed array, separated by the specified separator char.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImploded

      public static <ELEMENTTYPE> @NonNull String getImploded(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen)
      Get a concatenated String from all elements of the passed array, separated by the specified separator string.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      Returns:
      The concatenated string.
    • getImplodedMapped

      public static <ELEMENTTYPE> @NonNull String getImplodedMapped(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, separated by the specified separator string.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMapped

      public static <ELEMENTTYPE> @NonNull String getImplodedMapped(char cSep, @Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, separated by the specified separator char.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMapped

      public static <ELEMENTTYPE> @NonNull String getImplodedMapped(char cSep, @Nullable ELEMENTTYPE[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, separated by the specified separator char.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMapped

      public static <ELEMENTTYPE> @NonNull String getImplodedMapped(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, separated by the specified separator string.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImploded

      public static <ELEMENTTYPE> @NonNull String getImploded(char cSep, @Nullable ELEMENTTYPE[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen)
      Get a concatenated String from all elements of the passed array, separated by the specified separator char.
      Type Parameters:
      ELEMENTTYPE - The type of elements to be imploded.
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      Returns:
      The concatenated string.
    • getImplodedNonEmpty

      public static @NonNull String getImplodedNonEmpty(@Nullable Collection<String> aElements)
      Get a concatenated String from all non-null and non empty elements of the passed container without a separator string. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Parameters:
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImplodedMappedNonEmpty

      public static <ELEMENTTYPE> @NonNull String getImplodedMappedNonEmpty(@Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all non-null and non empty elements of the passed container without a separator string. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Type Parameters:
      ELEMENTTYPE - Iterable element type
      Parameters:
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMappedNonEmpty

      public static <ELEMENTTYPE> @NonNull String getImplodedMappedNonEmpty(@Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all non-null and non empty elements of the passed container without a separator string. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Type Parameters:
      ELEMENTTYPE - Array component type
      Parameters:
      aElements - The array to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedNonEmpty

      public static @NonNull String getImplodedNonEmpty(@NonNull String sSep, @Nullable Collection<String> aElements)
      Get a concatenated String from all non-null and non empty elements of the passed container, separated by the specified separator string. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImplodedNonEmpty

      public static @NonNull String getImplodedNonEmpty(char cSep, @Nullable Collection<String> aElements)
      Get a concatenated String from all non-null and non empty elements of the passed container, separated by the specified separator char. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImplodedMappedNonEmpty

      public static <ELEMENTTYPE> @NonNull String getImplodedMappedNonEmpty(@NonNull String sSep, @Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all non-null and non empty elements of the passed container, separated by the specified separator string. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Type Parameters:
      ELEMENTTYPE - The element type of the collection to be imploded
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMappedNonEmpty

      public static <ELEMENTTYPE> @NonNull String getImplodedMappedNonEmpty(char cSep, @Nullable Collection<? extends ELEMENTTYPE> aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all non-null and non empty elements of the passed container, separated by the specified separator char. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Type Parameters:
      ELEMENTTYPE - The element type of the collection to be imploded
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedNonEmpty

      public static @NonNull String getImplodedNonEmpty(@NonNull String sSep, @Nullable String... aElements)
      Get a concatenated String from all elements of the passed array, separated by the specified separator string. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImplodedNonEmpty

      public static @NonNull String getImplodedNonEmpty(char cSep, @Nullable String... aElements)
      Get a concatenated String from all elements of the passed array, separated by the specified separator char. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImplodedMappedNonEmpty

      public static <ELEMENTTYPE> @NonNull String getImplodedMappedNonEmpty(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, separated by the specified separator string. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Type Parameters:
      ELEMENTTYPE - Array component type
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMappedNonEmpty

      public static <ELEMENTTYPE> @NonNull String getImplodedMappedNonEmpty(char cSep, @Nullable ELEMENTTYPE[] aElements, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, separated by the specified separator char. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Type Parameters:
      ELEMENTTYPE - Array component type
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedNonEmpty

      public static @NonNull String getImplodedNonEmpty(@NonNull String sSep, @Nullable String[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen)
      Get a concatenated String from all elements of the passed array, separated by the specified separator string. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      Returns:
      The concatenated string.
    • getImplodedNonEmpty

      public static @NonNull String getImplodedNonEmpty(char cSep, @Nullable String[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen)
      Get a concatenated String from all elements of the passed array, separated by the specified separator char. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      Returns:
      The concatenated string.
    • getImplodedMappedNonEmpty

      public static <ELEMENTTYPE> @NonNull String getImplodedMappedNonEmpty(@NonNull String sSep, @Nullable ELEMENTTYPE[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, separated by the specified separator string. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Type Parameters:
      ELEMENTTYPE - Array component type
      Parameters:
      sSep - The separator to use. May not be null.
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMappedNonEmpty

      public static <ELEMENTTYPE> @NonNull String getImplodedMappedNonEmpty(char cSep, @Nullable ELEMENTTYPE[] aElements, @Nonnegative int nOfs, @Nonnegative int nLen, @NonNull Function<? super ELEMENTTYPE,String> aMapper)
      Get a concatenated String from all elements of the passed array, separated by the specified separator char. This the very generic version of getConcatenatedOnDemand for an arbitrary number of elements.
      Type Parameters:
      ELEMENTTYPE - Array component type
      Parameters:
      cSep - The separator to use.
      aElements - The container to convert. May be null or empty.
      nOfs - The offset to start from.
      nLen - The number of elements to implode.
      aMapper - The mapping function to convert from ELEMENTTYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • imploderMap

      public static @NonNull StringImplode.ImploderBuilderMap imploderMap()
      Returns:
      A new StringImplode.ImploderBuilderMap.
      Since:
      10.0.0
    • getImploded

      public static <KEYTYPE, VALUETYPE> @NonNull String getImploded(@NonNull String sSepOuter, @NonNull String sSepInner, @Nullable Map<KEYTYPE,VALUETYPE> aElements)
      Get a concatenated String from all elements of the passed map, separated by the specified separator strings.
      Type Parameters:
      KEYTYPE - Map key type
      VALUETYPE - Map value type
      Parameters:
      sSepOuter - The separator to use for separating the map entries. May not be null.
      sSepInner - The separator to use for separating the key from the value. May not be null.
      aElements - The map to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImploded

      public static <KEYTYPE, VALUETYPE> @NonNull String getImploded(char cSepOuter, char cSepInner, @Nullable Map<KEYTYPE,VALUETYPE> aElements)
      Get a concatenated String from all elements of the passed map, separated by the specified separator chars.
      Type Parameters:
      KEYTYPE - Map key type
      VALUETYPE - Map value type
      Parameters:
      cSepOuter - The separator to use for separating the map entries.
      cSepInner - The separator to use for separating the key from the value.
      aElements - The map to convert. May be null or empty.
      Returns:
      The concatenated string.
    • getImplodedMapped

      public static <KEYTYPE, VALUETYPE> @NonNull String getImplodedMapped(@NonNull String sSepOuter, @NonNull String sSepInner, @Nullable Map<? extends KEYTYPE,? extends VALUETYPE> aElements, @NonNull Function<? super KEYTYPE,String> aKeyMapper, @NonNull Function<? super VALUETYPE,String> aValueMapper)
      Get a concatenated String from all elements of the passed map, separated by the specified separator strings.
      Type Parameters:
      KEYTYPE - Map key type
      VALUETYPE - Map value type
      Parameters:
      sSepOuter - The separator to use for separating the map entries. May not be null.
      sSepInner - The separator to use for separating the key from the value. May not be null.
      aElements - The map to convert. May be null or empty.
      aKeyMapper - The mapping function to convert from KEYTYPE to String. May not be null.
      aValueMapper - The mapping function to convert from VALUETYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6
    • getImplodedMapped

      public static <KEYTYPE, VALUETYPE> @NonNull String getImplodedMapped(char cSepOuter, char cSepInner, @Nullable Map<? extends KEYTYPE,? extends VALUETYPE> aElements, @NonNull Function<? super KEYTYPE,String> aKeyMapper, @NonNull Function<? super VALUETYPE,String> aValueMapper)
      Get a concatenated String from all elements of the passed map, separated by the specified separator chars.
      Type Parameters:
      KEYTYPE - Map key type
      VALUETYPE - Map value type
      Parameters:
      cSepOuter - The separator to use for separating the map entries.
      cSepInner - The separator to use for separating the key from the value.
      aElements - The map to convert. May be null or empty.
      aKeyMapper - The mapping function to convert from KEYTYPE to String. May not be null.
      aValueMapper - The mapping function to convert from VALUETYPE to String. May not be null.
      Returns:
      The concatenated string.
      Since:
      8.5.6