public final class DoubleArrayList
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
DoubleArrayList()
Constructs an empty list.
|
DoubleArrayList(double[] values)
Constructs a list containing the values of the specified array.
|
DoubleArrayList(int capacity)
Constructs an empty list with the specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(double val)
Appends the specified value to the end of this list.
|
void |
add(double[] vals)
Appends an array to the end of this list.
|
void |
clear()
Removes all of the values from this list.
|
void |
ensureCapacity(int capacity)
Increases the capacity, if necessary, to ensure that it can hold
at least the number of values specified by the minimum capacity
argument.
|
double |
get(int index)
Returns the value at the specified position in this list.
|
boolean |
isEmpty()
Returns true if this list contains no values.
|
double |
remove(int index)
Removes the value at specified index from the list.
|
DoubleArrayList |
set(int index,
double val)
Replaces the value at the specified position in this list with the
specified value.
|
int |
size()
Returns the number of values in the list.
|
double[] |
toArray()
Returns an array containing all of the values in this list in
proper sequence (from first to last value).
|
double[] |
toArray(double[] dest)
Returns an array containing all of the values in this list in
proper sequence (from first to last value).
|
void |
trimToSize()
Trims the capacity to be the list's current size.
|
public DoubleArrayList()
public DoubleArrayList(int capacity)
capacity - the initial size of array list.public DoubleArrayList(double[] values)
values - the initial values of array list.public void ensureCapacity(int capacity)
capacity - the desired minimum capacity.public int size()
public boolean isEmpty()
public void trimToSize()
public void add(double val)
val - a value to be appended to this list.public void add(double[] vals)
vals - an array to be appended to this list.public double get(int index)
index - index of the value to returnpublic DoubleArrayList set(int index, double val)
index - index of the value to replaceval - value to be stored at the specified positionjava.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index ≥ size())public void clear()
public double remove(int index)
index - index of the value to remove.java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index ≥ size())public double[] toArray()
public double[] toArray(double[] dest)
dest - the array into which the values of the list are to
be stored, if it is big enough; otherwise, a new array is allocated
for this purpose.