- All Implemented Interfaces:
Serializable,Cloneable,Iterable<String>,Collection<String>,List<String>,RandomAccess,SequencedCollection<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:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic StringNon-static version, that joins "this" StringList.static Stringjoin(Collection<String> c, String delim) Deprecated.static StringListString[]toArray()toString()Joins each string in the list with a newline.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll, reversed
-
Constructor Details
-
StringList
public StringList() -
StringList
-
-
Method Details
-
addAll
-
split
- Parameters:
orig- the original stringdelim- a delimiter to use for splitting- Returns:
- a new StringList containing the split strings.
-
toString
Joins each string in the list with a newline.- Overrides:
toStringin classAbstractCollection<String>- Returns:
- a joined string representation of this, with the newline (\n) as delimiter.
-
toArray
-
join
Deprecated.useString.join(CharSequence, CharSequence...)orString.join(CharSequence, Iterable), thos methods are available since Java 8 and are faster in all situationsThe reverse of split - given a collection, takes each element and places it in a string, joined by a delimiter. -
join
- Parameters:
arr- array of objectsdelim- delimiter to separate strings- Returns:
- a single string with each element in arr converted to a string and concatenated, separated by delim.
-
join
Non-static version, that joins "this" StringList.- Parameters:
delim- the delimiter- Returns:
- a joined string with delim inbetween each element
-
String.join(CharSequence, CharSequence...)orString.join(CharSequence, Iterable), thos methods are available since Java 8 and are faster in all situations