Class StringJoiner

java.lang.Object
ch.tocco.nice2.toolbox.api.string.StringJoiner
All Implemented Interfaces:
Appendable

@Deprecated public class StringJoiner extends Object implements Appendable
Deprecated.
use Joiner
String Builder class that supports automatic insertion of an in-between concatenation string.

Example usage: StringJoiner sj = new StringJoiner(", "); sj.append("tom").append("jones").get().toString(); It also features some static methods for simple tasks: String s = StringJoiner.join(myCollection); String s = StringJoiner.join(myCollection, ", ");

Not synchronized, relies on StringBuilder.

  • Constructor Details

    • StringJoiner

      public StringJoiner(StringBuilder sb, @Nullable @Nullable String concat)
      Deprecated.
      Creates a new instance with a concatenation string.
      Parameters:
      sb - A StringBuilder if you have one already.
      concat - The concatenation string will be used from the 2nd call to append(java.lang.CharSequence).
    • StringJoiner

      public StringJoiner(@Nullable @Nullable String concat)
      Deprecated.
      Creates a new instance with a concatenation string. Overloaded method that creates a new StringBuilder.
      Parameters:
      concat - The concatenation string will be used from the 2nd call to append(java.lang.CharSequence).
      See Also:
    • StringJoiner

      public StringJoiner()
      Deprecated.
      Creates a new instance without a concatenation string to begin with. One may be set later using resetConcat(java.lang.String). Overloaded method that creates a new StringBuilder.
      See Also:
  • Method Details

    • clearConcat

      public StringJoiner clearConcat()
      Deprecated.
      Voids (kills) any concatenation string, but does NOT reset the loop status.
      Returns:
      A reference to this StringJoiner.
    • reset

      public StringJoiner reset()
      Deprecated.
      Resets the loop status, keeps the current concatenation string (if any). The concatenation string will be used again from the 2nd call to append(java.lang.CharSequence).
      Returns:
      A reference to this StringJoiner.
    • resetConcat

      public StringJoiner resetConcat(@Nullable @Nullable String concat)
      Deprecated.
      Resets the loop status and sets a new concatenation string.
      Parameters:
      concat - The new concatenation string which will be used from the 2nd call to append(java.lang.CharSequence).
      Returns:
      A reference to this StringJoiner.
    • append

      public StringJoiner append(CharSequence charSequence)
      Deprecated.
      Specified by:
      append in interface Appendable
    • append

      public StringJoiner append(CharSequence charSequence, int i, int i1)
      Deprecated.
      Specified by:
      append in interface Appendable
    • append

      public StringJoiner append(char c)
      Deprecated.
      Specified by:
      append in interface Appendable
    • append

      public StringJoiner append(Object o)
      Deprecated.
    • appendAll

      public StringJoiner appendAll(Iterable<?> objects)
      Deprecated.
      Appends each element of an object. Ignores null values.
      Parameters:
      objects - The elements.
      Returns:
      A reference to this StringJoiner.
    • appendAll

      public StringJoiner appendAll(Object[] objects)
      Deprecated.
      Appends each element of an object. Ignores null values. Overloaded method for Object[] (stupid java until se6).
      Parameters:
      objects - The elements.
      Returns:
      A reference to this StringJoiner.
    • appendConcat

      public StringJoiner appendConcat()
      Deprecated.
      Forces the string joiner to append the current concatenation string, if any.
      Returns:
      A reference to this StringJoiner.
    • get

      public StringBuilder get()
      Deprecated.
      Returns a reference to the StringBuilder in use.
      Returns:
      The internal builder, use it as output or for accessing its broader API.
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object
    • join

      public static String join(Iterable<?> objects)
      Deprecated.
    • join

      public static String join(Object[] objects)
      Deprecated.
    • join

      public static String join(Iterable<?> objects, String concat)
      Deprecated.
    • join

      public static String join(Object[] objects, String concat)
      Deprecated.