public final class StringList extends Object
What is called a list of Strings here is simply an array of Strings.
Such array may not contain null elements.
| Modifier and Type | Field and Description |
|---|---|
static String[] |
EMPTY_LIST
A ready-to-use empty list of Strings.
|
| Modifier and Type | Method and Description |
|---|---|
static String[] |
append(String[] strings,
String string)
Inserts a String as last item of a list of Strings.
|
static boolean |
contains(String[] strings,
String string)
Tests if list
strings contains String string. |
static boolean |
containsIgnoreCase(String[] strings,
String string)
Same as
contains(java.lang.String[], java.lang.String) but string comparison is case-insensitive. |
static int |
indexOf(String[] strings,
String string)
Searches String
string within list strings. |
static String[] |
insertAt(String[] strings,
String string,
int index)
Inserts a String inside a list of Strings.
|
static String[] |
prepend(String[] strings,
String string)
Inserts a String as first item of a list of Strings.
|
static String[] |
remove(String[] strings,
String string)
Removes a String from a list of Strings.
|
static String[] |
removeAt(String[] strings,
int index)
Removes an item specified by its position from a list of Strings.
|
public static final String[] EMPTY_LIST
public static int indexOf(String[] strings, String string)
string within list strings.strings - the list to be searchedstring - the String to search forpublic static boolean contains(String[] strings, String string)
strings contains String string.strings - the list to be searchedstring - the String to search fortrue the string is found and false
otherwisepublic static boolean containsIgnoreCase(String[] strings, String string)
contains(java.lang.String[], java.lang.String) but string comparison is case-insensitive.public static String[] insertAt(String[] strings, String string, int index)
strings - the list where a String is to be insertedstring - the String to insertindex - the insertion indexstrings
plus String string inserted at position indexpublic static String[] prepend(String[] strings, String string)
strings - the list where a String is to be insertedstring - the String to insertstrings
plus String string inserted at its beginningpublic static String[] append(String[] strings, String string)
strings - the list where a String is to be insertedstring - the String to insertstrings
plus String string inserted at its endpublic static String[] remove(String[] strings, String string)
strings - the list where a String is to be removedstring - the String to removestrings
less String string if such String is contained in the
list; the original list otherwisepublic static String[] removeAt(String[] strings, int index)
strings - the list where an item is to be removedindex - the position of the item to removestrings
less the item at position index