public class StringList extends ElementList implements Iterable<String>
Modifier and Type | Field and Description |
---|---|
protected String[] |
list
Element container.
|
size
Constructor and Description |
---|
StringList()
Default constructor.
|
StringList(int capacity)
Constructor, specifying an initial internal array size.
|
StringList(String... elements)
Lightweight constructor, assigning the specified array.
|
Modifier and Type | Method and Description |
---|---|
StringList |
add(String... elements)
Adds elements to the array.
|
StringList |
add(String element)
Adds an element to the array.
|
StringList |
add(StringList elements)
Adds elements from a string list to the array.
|
boolean |
contains(String element)
Checks if the specified element is found in the list.
|
boolean |
containsAll(StringList elements)
Check if all elements of the specified list are contained in the list.
|
void |
delete(String element)
Removes all occurrences of the specified element from the list.
|
String[] |
finish()
Returns an array with all elements and invalidates the internal array.
|
String |
get(int index)
Returns the element at the specified position.
|
Iterator<String> |
iterator() |
String[] |
next()
Returns an array with all elements and resets the array size.
|
String |
remove(int index)
Deletes the element at the specified position.
|
void |
set(int index,
String element)
Sets an element at the specified index position.
|
StringList |
sort()
Sorts the elements in ascending order, using the standard options.
|
StringList |
sort(boolean cs)
Sorts the elements in ascending order.
|
StringList |
sort(boolean cs,
boolean asc)
Sorts the elements.
|
StringList |
sort(boolean cs,
boolean asc,
int index)
Sorts the elements.
|
String[] |
toArray()
Returns an array with all elements.
|
String |
toString() |
StringList |
unique()
Removes duplicates, provided that the entries are sorted.
|
protected String[] list
public StringList()
public StringList(int capacity)
capacity
- initial array capacitypublic StringList(String... elements)
elements
- initial arraypublic final StringList add(String element)
element
- element to be addedpublic final StringList add(String... elements)
elements
- elements to be addedpublic final StringList add(StringList elements)
elements
- string list to be addedpublic final String get(int index)
index
- element indexpublic final void set(int index, String element)
index
- indexelement
- element to be setpublic final boolean contains(String element)
element
- element to be foundpublic final boolean containsAll(StringList elements)
elements
- sorted listpublic final String remove(int index)
index
- index of the element to deletepublic final void delete(String element)
element
- element to be removedpublic final String[] toArray()
public final String[] next()
public String[] finish()
public final StringList sort()
public final StringList sort(boolean cs)
cs
- respect case sensitivitypublic final StringList sort(boolean cs, boolean asc)
cs
- respect case sensitivityasc
- ascending/descending flagpublic final StringList sort(boolean cs, boolean asc, int index)
cs
- respect case sensitivityasc
- ascending (true)/descending (false) flagindex
- index of element from which sorting startspublic StringList unique()
Copyright © 2005–2015 BaseX Team. All rights reserved.