Class StringArray

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.String>, java.util.Collection<java.lang.String>, java.util.List<java.lang.String>, java.util.RandomAccess

    public class StringArray
    extends java.util.ArrayList<java.lang.String>
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      StringArray()
      constructor
      StringArray​(java.lang.String strIn)
      convenience - constructs a VString by tokenizing a string
      StringArray​(java.lang.String[] a)
      creates a VString from an array of Strings
      StringArray​(java.lang.String strIn, java.lang.String strSep)
      constructs a VString by tokenizing a string
      StringArray​(java.util.Collection<java.lang.String> m)
      constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, java.lang.String element)  
      boolean add​(java.lang.String e)  
      void addAll​(java.lang.String[] strings)
      appends all strings of an array to this
      void addNonEmpty​(java.lang.String text)
      add a string if it is not empty
      void appendUnique​(java.lang.String string)
      AppendUnique - append a string but ignore multiple entries
      void appendUnique​(java.util.Collection<java.lang.String> v)
      AppendUnique - append a vector but ignore multiple entries
      boolean containsAny​(java.util.Collection<java.lang.String> others)
      checks whether at least one of a given vector of strings is contained in this
      java.lang.String get​(int index)  
      StringArray getOverlapping​(java.util.Collection<java.lang.String> others)
      vector of strings that is contained in this
      java.util.Set<java.lang.String> getSet()
      gets a set with all entries of the VString
      note that the set retains ordering (LinkedHashSet)
      java.lang.String getString()
      serialize to a string
      java.lang.String getString​(java.lang.String sep, java.lang.String front, java.lang.String back)
      serialize to a string
      static StringArray getVString​(java.lang.String strIn, java.lang.String strSep)
      simple static factory - null if strIn is null or empty
      static boolean isEmpty​(java.util.Collection<java.lang.String> v)
      are we null or empty or contain only an empty JDFAttributeMap
      java.lang.String remove​(int index)
      remove but also implementing the usual neg number syntax
      java.lang.String set​(int index, java.lang.String element)  
      void unify()
      unify - make VString unique, retaining initial order
      • Methods inherited from class java.util.ArrayList

        addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • StringArray

        public StringArray()
        constructor
      • StringArray

        public StringArray​(java.util.Collection<java.lang.String> m)
        constructor
        Parameters:
        m -
      • StringArray

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

        public StringArray​(java.lang.String strIn,
                           java.lang.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​(java.lang.String[] a)
        creates a VString from an array of Strings
        Parameters:
        a - the array
    • Method Detail

      • set

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

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

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

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

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

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

        public void appendUnique​(java.lang.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​(java.util.Collection<java.lang.String> v)
        AppendUnique - append a vector but ignore multiple entries
        Parameters:
        v - the vector to append, if null nothing is added
      • getString

        public java.lang.String getString​(java.lang.String sep,
                                          java.lang.String front,
                                          java.lang.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 java.lang.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 java.util.Set<java.lang.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​(java.lang.String[] strings)
        appends all strings of an array to this
        Parameters:
        strings - the array of strings to append to this
      • containsAny

        public boolean containsAny​(java.util.Collection<java.lang.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​(java.util.Collection<java.lang.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 java.lang.String remove​(int index)
        remove but also implementing the usual neg number syntax
        Specified by:
        remove in interface java.util.List<java.lang.String>
        Overrides:
        remove in class java.util.ArrayList<java.lang.String>
        Parameters:
        index - if 0, or positive count from front, else if negative from back
        See Also:
        Vector.remove(int)
      • addNonEmpty

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