public final class TokenList extends ElementList implements Iterable<byte[]>
size
Constructor and Description |
---|
TokenList()
Default constructor.
|
TokenList(byte[]... elements)
Lightweight constructor, assigning the specified array.
|
TokenList(double resize)
Constructor, specifying a resize factor.
|
TokenList(int capacity)
Constructor, specifying an initial internal array size
(default is
Array.CAPACITY ). |
TokenList(TokenSet set)
Constructor, adopting the elements from the specified set.
|
Modifier and Type | Method and Description |
---|---|
TokenList |
add(byte[]... elements)
Adds elements to the array.
|
TokenList |
add(byte[] element)
Adds an element.
|
void |
add(long element)
Adds a long value.
|
void |
add(String element)
Adds a string.
|
boolean |
contains(byte[] element)
Checks if the specified element is found in the list.
|
byte[][] |
finish()
Returns the token as byte array, and invalidates the internal array.
|
byte[] |
get(int index)
Returns the element at the specified position.
|
void |
insert(int index,
byte[][] elements)
Inserts the given elements at the specified position.
|
Iterator<byte[]> |
iterator() |
byte[][] |
next()
Returns an array with all elements and resets the array size.
|
byte[] |
peek()
Returns the uppermost element on the stack, without removing it.
|
byte[] |
pop()
Pops the uppermost element from the stack.
|
void |
push(byte[] element)
Pushes an element onto the stack.
|
byte[] |
remove(int index)
Deletes the element at the specified position.
|
void |
set(int index,
byte[] element)
Stores an element to the specified position.
|
TokenList |
sort(boolean cs)
Sorts the elements.
|
TokenList |
sort(boolean cs,
boolean asc)
Sorts the elements.
|
byte[][] |
toArray()
Returns an array with all elements.
|
String |
toString() |
String[] |
toStringArray()
Returns an array with all elements as strings.
|
TokenList |
unique()
Removes duplicates from the list.
|
public TokenList()
public TokenList(int capacity)
Array.CAPACITY
).capacity
- initial array capacitypublic TokenList(double resize)
resize
- resize factorpublic TokenList(TokenSet set)
set
- set to be addedpublic TokenList(byte[]... elements)
elements
- initial arraypublic TokenList add(byte[] element)
element
- element to be addedpublic TokenList add(byte[]... elements)
elements
- elements to be addedpublic void add(long element)
element
- element to be addedpublic void add(String element)
element
- element to be addedpublic void insert(int index, byte[][] elements)
index
- inserting positionelements
- elements to insertpublic byte[] remove(int index)
index
- index of the element to deletepublic byte[] get(int index)
index
- index of the element to returnpublic void set(int index, byte[] element)
index
- index of the element to replaceelement
- element to be storedpublic byte[] pop()
public void push(byte[] element)
element
- elementpublic byte[] peek()
public boolean contains(byte[] element)
element
- element to be foundpublic byte[][] toArray()
public byte[][] next()
public byte[][] finish()
public String[] toStringArray()
public TokenList sort(boolean cs)
cs
- respect case sensitivitypublic TokenList sort(boolean cs, boolean asc)
cs
- respect case sensitivityasc
- ascending (true)/descending (false) flagpublic TokenList unique()
Copyright © 2005–2015 BaseX Team. All rights reserved.