Package org.basex.util.list
Class DoubleList
java.lang.Object
org.basex.util.list.ElementList
org.basex.util.list.DoubleList
Resizable-array implementation for native double values.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
FieldsFields inherited from class org.basex.util.list.ElementList
factor, size -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DoubleList(long capacity) Constructor with initial capacity. -
Method Summary
Modifier and TypeMethodDescriptionfinal DoubleListadd(double element) Adds an element to the array.final DoubleListadd(double... elements) Adds elements to the array.booleandouble[]finish()Returns an array with all elements and invalidates the internal array.final doubleget(int index) Returns the element at the specified position.final double[]toArray()Returns an array with all elements.toString()Methods inherited from class org.basex.util.list.ElementList
isEmpty, newCapacity, newCapacity, reset, size, size
-
Field Details
-
list
protected double[] listElement container.
-
-
Constructor Details
-
DoubleList
public DoubleList()Default constructor. -
DoubleList
public DoubleList(long capacity) Constructor with initial capacity.- Parameters:
capacity- array capacity
-
-
Method Details
-
add
Adds an element to the array.- Parameters:
element- element to be added- Returns:
- self reference
-
add
Adds elements to the array.- Parameters:
elements- elements to be added- Returns:
- self reference
-
get
public final double get(int index) Returns the element at the specified position.- Parameters:
index- index of the element to return- Returns:
- element
-
toArray
public final double[] toArray()Returns an array with all elements.- Returns:
- array
-
finish
public double[] finish()Returns an array with all elements and invalidates the internal array. Warning: the function must only be called if the list is discarded afterwards.- Returns:
- array (internal representation!)
-
equals
-
toString
-