A typesafe, mutable list of strings supporting a variety of convenient operations as well as expected operations from List such as add(), size(), remove(), iterator(), get(int index) and toArray(). Instances of the class are not threadsafe.
StringList objects can be constructed empty or they can be created using any of several static factory methods:
- valueOf(String[])
- valueOf(String)
- valueOf(Collection)
- valueOf(Object[])
In the case of the Collection and Object[] factory methods, each Object in the collection or array is converted to a String via toString() before being added to the StringList.
The tokenize() factory methods allow easy creation of StringLists via StringTokenizer. The repeat() static factory method creates a StringList that repeats a given String a given number of times.
The prepend() method adds a String to the beginning of the StringList. The removeLast() method pops a String off the end of the list. The sort() method sorts strings in the List using Collections.sort(). The class also inherits useful methods from AbstractStringList that include join() methods ala Perl and a toString() method which joins the list of strings with comma separators for easy viewing.
@author Jonathan Locke