Package org.basex.util.list
Class TokenList
java.lang.Object
org.basex.util.list.ElementList
org.basex.util.list.ObjectList<byte[],TokenList>
org.basex.util.list.TokenList
- All Implemented Interfaces:
Iterable<byte[]>
Resizable-array implementation for tokens (byte arrays).
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields inherited from class org.basex.util.list.ObjectList
listFields inherited from class org.basex.util.list.ElementList
factor, size -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.TokenList(byte[]... elements) Lightweight constructor, assigning the specified array.TokenList(double factor) Constructor, specifying a resize factor.TokenList(long capacity) Constructor with initial capacity.Constructor, adopting the elements from the specified set. -
Method Summary
Modifier and TypeMethodDescriptionadd(long element) Adds a long value.Adds a string.booleanequals(byte[] element1, byte[] element2) Compares two list elements.protected byte[][]newArray(int s) Creates a resized array.sort()Sorts the elements.sort(boolean cs) Sorts the elements.sort(boolean cs, boolean ascending) Sorts the elements.Methods inherited from class org.basex.util.list.ObjectList
add, add, add, addUnique, contains, equals, finish, get, insert, iterator, next, peek, pop, push, remove, removeAll, removeAll, set, sort, toArray, toString, uniqueMethods inherited from class org.basex.util.list.ElementList
isEmpty, newCapacity, newCapacity, reset, size, sizeMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TokenList
public TokenList()Default constructor. -
TokenList
public TokenList(long capacity) Constructor with initial capacity.- Parameters:
capacity- array capacity
-
TokenList
public TokenList(double factor) Constructor, specifying a resize factor. Smaller values are more memory-saving, while larger will provide better performance.- Parameters:
factor- resize factor
-
TokenList
Constructor, adopting the elements from the specified set.- Parameters:
set- set to be added
-
TokenList
public TokenList(byte[]... elements) Lightweight constructor, assigning the specified array.- Parameters:
elements- initial array
-
-
Method Details
-
add
Adds a long value.- Parameters:
element- element to be added- Returns:
- self reference
-
add
Adds a string.- Parameters:
element- element to be added- Returns:
- self reference
-
equals
public boolean equals(byte[] element1, byte[] element2) Description copied from class:ObjectListCompares two list elements.- Overrides:
equalsin classObjectList<byte[],TokenList> - Parameters:
element1- first elementelement2- second element- Returns:
- result of check
-
sort
Sorts the elements.- Returns:
- self reference
-
sort
Sorts the elements.- Parameters:
cs- respect case sensitivity- Returns:
- self reference
-
sort
Sorts the elements.- Parameters:
cs- respect case sensitivityascending- ascending/descending order- Returns:
- self reference
-
newArray
protected byte[][] newArray(int s) Description copied from class:ObjectListCreates a resized array.- Specified by:
newArrayin classObjectList<byte[],TokenList> - Parameters:
s- size- Returns:
- array
-