Module jEdit

Class StringList

All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, List<String>, RandomAccess

public class StringList extends ArrayList<String>
A List<String> with some perl-like convenience functions (split/join primarily), and easy conversion to/from arrays.
Since:
jEdit 4.3pre7
See Also:
  • Constructor Details

    • StringList

      public StringList()
    • StringList

      public StringList(Object[] array)
  • Method Details

    • addAll

      public void addAll(Object[] array)
    • split

      public static StringList split(String orig, Object delim)
      Parameters:
      orig - the original string
      delim - a delimiter to use for splitting
      Returns:
      a new StringList containing the split strings.
    • toString

      public String toString()
      Joins each string in the list with a newline.
      Overrides:
      toString in class AbstractCollection<String>
      Returns:
      a joined string representation of this, with the newline (\n) as delimiter.
    • toArray

      @Nonnull public String[] toArray()
      Specified by:
      toArray in interface Collection<String>
      Specified by:
      toArray in interface List<String>
      Overrides:
      toArray in class ArrayList<String>
      Returns:
      an array of String
    • join

      @Deprecated public static String join(Collection<String> c, String delim)
      Deprecated.
      use String.join(CharSequence, CharSequence...) or String.join(CharSequence, Iterable), thos methods are available since Java 8 and are faster in all situations
      The reverse of split - given a collection, takes each element and places it in a string, joined by a delimiter.
    • join

      public static String join(Object[] arr, String delim)
      Parameters:
      arr - array of objects
      delim - delimiter to separate strings
      Returns:
      a single string with each element in arr converted to a string and concatenated, separated by delim.
    • join

      public String join(String delim)
      Non-static version, that joins "this" StringList.
      Parameters:
      delim - the delimiter
      Returns:
      a joined string with delim inbetween each element