public class StringList extends ArrayList<String>
ArrayList<String>
. modCount
Constructor and Description |
---|
StringList()
Default constructor
|
StringList(List<String> list)
Constructs a StringList on the basis of another StringList.
|
StringList(Object[] objs)
Constructs a StringList on the basis of an array of Objects.
|
StringList(String s)
Constructs a StringList which starts with one string.
|
StringList(String[] strings)
Constructs a StringList on the basis of an array of strings.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
asList()
Returns the list as a list of Strings, and not a StringList instance.
|
List<String> |
asUnmodifiableList()
Returns this list as an unmodifiableList of strings.
|
StringList |
getAllThatContains(String contains,
boolean caseSensitive)
Get all the lines that contains a certain text value in a seperate StringList
|
int |
getIndexForFirstContainLine(String contains,
boolean caseSensitive)
Gets the index of the first String in the StringList containing the certain text value.
|
String |
getLineForFirstContainLine(String contains,
boolean caseSensitive)
Gets the line of the first String in the StringList containing the certain text value.
|
void |
println()
Print all the lines to System.out.println.
|
void |
sort()
Sorts the this list of strings using "Collections.sort()".
|
StringList |
subList(int fromIndex,
int toIndex) |
String |
toString()
Appends all the strings in the list to one string.
|
String |
toString(String divider)
Appends all the strings in the list to one string, divided by the divider.
|
String[] |
toStringArray()
Returns the StringList as an array of Strings.
|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArray, trimToSize
equals, hashCode
containsAll
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode
parallelStream, stream
public StringList()
public StringList(List<String> list)
list
- the other list to construct with, if the list is null
, it is ignored.public StringList(String s)
s
- a string which is added as the first entry. If the s is null
, it is ignored.public StringList(String[] strings)
strings
- an array of strings which is added. If the strings is null
, it is ignored.public StringList(Object[] objs)
objs
- an array of Objects which is added as "toString()". If the objs is null
, it is ignored, or any of the objects in the array is null
it is ignored.public final List<String> asUnmodifiableList()
Collections.unmodifiableList(List)
public List<String> asList()
public void sort()
Collections.sort(List)
public final int getIndexForFirstContainLine(String contains, boolean caseSensitive)
contains
- the text to search for.caseSensitive
- if the search shall be case sensitive or not.public final String getLineForFirstContainLine(String contains, boolean caseSensitive)
contains
- the text to search for.caseSensitive
- if the search shall be case sensitive or not.null
is returned.public final StringList getAllThatContains(String contains, boolean caseSensitive)
contains
- the text to search for.caseSensitive
- if the search shall be case sensitive or not.public final StringList subList(int fromIndex, int toIndex)
public final String[] toStringArray()
public final void println()
public String toString()
toString
in class AbstractCollection<String>