Class StringArray

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

public class StringArray extends ArrayList<String>
See Also:
  • Constructor Details

    • StringArray

      public StringArray()
      constructor
    • StringArray

      public StringArray(Collection<String> m)
      constructor
      Parameters:
      m -
    • StringArray

      public StringArray(String strIn)
      convenience - constructs a VString by tokenizing a string
      Parameters:
      strIn - the string to tokenize by blank
    • StringArray

      public StringArray(String strIn, String strSep)
      constructs a VString by tokenizing a string
      Parameters:
      strIn - the string to tokenize
      strSep - the list of separator characters - null if whitespace
    • StringArray

      public StringArray(String[] a)
      creates a VString from an array of Strings
      Parameters:
      a - the array
  • Method Details

    • set

      public String set(int index, String element)
      Specified by:
      set in interface List<String>
      Overrides:
      set in class ArrayList<String>
    • add

      public boolean add(String e)
      Specified by:
      add in interface Collection<String>
      Specified by:
      add in interface List<String>
      Overrides:
      add in class ArrayList<String>
    • add

      public void add(int index, String element)
      Specified by:
      add in interface List<String>
      Overrides:
      add in class ArrayList<String>
    • isEmpty

      public static boolean isEmpty(Collection<String> v)
      are we null or empty or contain only an empty JDFAttributeMap
      Parameters:
      v -
      Returns:
    • getVString

      public static StringArray getVString(String strIn, String strSep)
      simple static factory - null if strIn is null or empty
      Parameters:
      strIn -
      strSep -
      Returns:
    • get

      public String get(int index)
      Specified by:
      get in interface List<String>
      Overrides:
      get in class ArrayList<String>
      Parameters:
      index - the index which may be negative to count backwards
      Returns:
      the string at index
    • appendUnique

      public void appendUnique(String string)
      AppendUnique - append a string but ignore multiple entries
      Parameters:
      string - the string to append, if null nothing is added
    • appendUnique

      public void appendUnique(Collection<String> v)
      AppendUnique - append a vector but ignore multiple entries
      Parameters:
      v - the vector to append, if null nothing is added
    • getString

      public String getString(String sep, String front, String back)
      serialize to a string
      Parameters:
      sep - separator between strings
      front - string before the first entry
      back - string after the last entry
      Returns:
      a tokenized string
    • getString

      public String getString()
      serialize to a string
      Parameters:
      sep - separator between strings
      front - string before the first entry
      back - string after the last entry
      Returns:
      a tokenized string
    • unify

      public void unify()
      unify - make VString unique, retaining initial order
    • getSet

      public Set<String> getSet()
      gets a set with all entries of the VString
      note that the set retains ordering (LinkedHashSet)
      Returns:
      the set corresponding to this
    • addAll

      public void addAll(String[] strings)
      appends all strings of an array to this
      Parameters:
      strings - the array of strings to append to this
    • containsAny

      public boolean containsAny(Collection<String> others)
      checks whether at least one of a given vector of strings is contained in this
      Parameters:
      others - the VSTring of values to test
      Returns:
      true if at least one String in other is in this
    • getOverlapping

      public StringArray getOverlapping(Collection<String> others)
      vector of strings that is contained in this
      Parameters:
      others - the VString of values to test
      Returns:
      true if at least one String in other is in this
    • remove

      public String remove(int index)
      remove but also implementing the usual neg number syntax
      Specified by:
      remove in interface List<String>
      Overrides:
      remove in class ArrayList<String>
      Parameters:
      index - if 0, or positive count from front, else if negative from back
      See Also:
    • addNonEmpty

      public void addNonEmpty(String text)
      add a string if it is not empty
      Parameters:
      text -