@Generated(value="Autogenerated by OpenJAX CodeGen Template (0.2.5)", date="2020-05-23") public class ArrayDoubleList extends PrimitiveArrayList<double[]> implements DoubleList, RandomAccess
The size
, isEmpty
, get
, and set
operations
run in constant time. The add
operation runs in amortized constant
time, that is, adding n elements requires O(n) time. All of the other
operations run in linear time (roughly speaking).
Each ArrayDoubleList
instance has a capacity. The capacity is
the size of the array used to store the elements in the list. It is always at
least as large as the list size. As elements are added to an ArrayDoubleList,
its capacity grows automatically. The details of the growth policy are not
specified beyond the fact that adding an element has constant amortized time
cost.
An application can increase the capacity of an ArrayDoubleList
instance
before adding a large number of elements using the ensureCapacity
operation. This may reduce the amount of incremental reallocation.
Note that this implementation is not synchronized. If
multiple threads access an ArrayDoubleList
instance concurrently, and
at least one of the threads modifies the list structurally, it must be
synchronized externally. (A structural modification is any operation that
adds or deletes one or more elements, or explicitly resizes the backing
array; merely setting the value of an element is not a structural
modification.) This is typically accomplished by synchronizing on some object
that naturally encapsulates the list.
Constructor and Description |
---|
ArrayDoubleList()
Creates an empty list with an initial capacity of five.
|
ArrayDoubleList(Collection<Double> c)
Creates a list containing the values of the specified collection, in the
order they are returned by the collection's iterator.
|
ArrayDoubleList(double... values)
Creates a list containing the values of the specified array.
|
ArrayDoubleList(double[] values,
int offset,
int length)
Creates a list containing the values of the specified array.
|
ArrayDoubleList(int initialCapacity)
Creates an empty list with the specified initial capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(double value)
Appends the specified value to the end of this list.
|
boolean |
add(int index,
double value)
Inserts the specified value at the specified position in this list.
|
boolean |
addAll(ArrayDoubleList list)
Appends all of the values in the specified list to the end of this list, in
the order that they are returned by the specified list's Iterator.
|
boolean |
addAll(ArrayDoubleList list,
int offset,
int length)
Appends all of the values in the specified list to the end of this list, in
the order that they are returned by the specified list's Iterator.
|
boolean |
addAll(Collection<Double> c)
Appends all of the values in the specified collection to the end of this
list, in the order that they are returned by the specified collection's
iterator.
|
boolean |
addAll(double... values)
Appends all of the values in the specified array to the end of this list,
in the order that they appear in the array.
|
boolean |
addAll(double[] values,
int offset,
int length)
Appends all of the values in the specified array to the end of this list,
in the order that they appear in the array.
|
boolean |
addAll(DoubleCollection c)
Appends all of the values in the specified collection to the end of this
list, in the order that they are returned by the specified collection's
iterator.
|
boolean |
addAll(int index,
ArrayDoubleList list)
Inserts all of the values in the specified list into this list, starting at
the specified position.
|
boolean |
addAll(int index,
ArrayDoubleList list,
int offset,
int length)
Inserts all of the values in the specified list into this list, starting at
the specified position.
|
boolean |
addAll(int index,
Collection<Double> c)
Appends all of the values in the specified collection to the end of this
list, in the order that they are returned by the specified collection's
iterator.
|
boolean |
addAll(int index,
double[] values,
int offset,
int length)
Appends all of the values in the specified array to the end of this list,
in the order that they appear in the array.
|
boolean |
addAll(int index,
DoubleCollection c)
Appends all of the values in the specified collection to the end of this
list, in the order that they are returned by the specified collection's
iterator.
|
ArrayDoubleList |
clone()
Creates and returns a copy of this list, containing the same value data in
this list.
|
void |
ensureCapacity(int minCapacity)
Increases the capacity of this
ArrayDoubleList instance, if
necessary, to ensure that it can hold at least the number of values
specified by the minimum capacity argument. |
boolean |
equals(Object obj)
Compares the specified object with this list for equality.
|
double |
get(int index)
Returns the value at the specified position in this list.
|
int |
hashCode()
Returns the hash code value for this list.
|
int |
indexOf(double value)
Returns the index of the first occurrence of the specified value in this
list, or -1 if this list does not contain the value.
|
DoubleIterator |
iterator()
Returns an iterator over the values in this list in proper sequence.
|
int |
lastIndexOf(double value)
Returns the index of the last occurrence of the specified value in this
list, or -1 if this list does not contain the value.
|
DoubleListIterator |
listIterator(int index)
Returns a double list iterator over the values in this list (in proper
sequence), starting at the specified position in the list.
|
DoubleStream |
parallelStream()
Returns a possibly parallel
DoubleStream over the values in this
collection. |
double |
removeIndex(int index)
Removes the value at the specified index in this list.
|
boolean |
retainAll(Collection<Double> c)
Retains only the values in this list that are contained in the specified
collection.
|
boolean |
retainAll(DoubleCollection c)
Retains only the values in this list that are contained in the specified
collection.
|
double |
set(int index,
double value)
Replaces the value at the specified position in this list with the
specified value.
|
void |
sort(DoubleComparator c)
Sorts the specified list according to the order induced by the specified
comparator.
|
void |
sort(Object[] p,
DoubleComparator c)
Sorts this specified paired array according to the order induced by the
specified comparator applied to the values in this list.
|
Spliterator.OfDouble |
spliterator()
Creates a
Spliterator.OfDouble over the values in this collection. |
DoubleStream |
stream()
Returns a sequential
DoubleStream over the values in this collection. |
ArrayDoubleList |
subList(int fromIndex,
int toIndex)
Returns a view of the portion of this list between the specified
fromIndex , inclusive, and toIndex , exclusive. |
double[] |
toArray(double[] a)
Returns an array containing all of the values in this collection in proper
sequence (from first to last value).
|
Double[] |
toArray(Double[] a)
Returns an array containing all of the values in this collection in proper
sequence (from first to last value).
|
String |
toString()
Returns a string representation of this list.
|
void |
trimToSize()
Trims the capacity of this
ArrayDoubleList instance to be the list's
current size. |
clear, isEmpty, size, updateState
finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, clear, contains, containsAll, isEmpty, listIterator, peek, pop, push, remove, removeAll, removeAll, removeAll, replaceAll, size, sort, sort, sort, sort
containsAll, containsAll, removeIf, toArray
public ArrayDoubleList()
public ArrayDoubleList(int initialCapacity)
initialCapacity
- The initial capacity of the list.IllegalArgumentException
- If the specified initial capacity is
negative.public ArrayDoubleList(double[] values, int offset, int length)
values
- The array whose values are to be placed into this list.offset
- The index of the first value to add.length
- The number of values to add.NullPointerException
- If the specified array is null.public ArrayDoubleList(double... values)
values
- The array whose values are to be placed into this list.NullPointerException
- If the specified array is null.public ArrayDoubleList(Collection<Double> c)
c
- The collection whose values are to be placed into this list.NullPointerException
- If the specified collection is null.public double get(int index)
DoubleList
get
in interface DoubleList
index
- Index of the value to return.public boolean add(double value)
DoubleList
add
in interface DoubleCollection
add
in interface DoubleList
value
- Value to be appended to this list.true
if this list changed as a result of the call.public boolean add(int index, double value)
DoubleList
add
in interface DoubleList
index
- Index at which the specified value is to be insertedvalue
- Value to be inserted.true
if this list changed as a result of the call.public boolean addAll(ArrayDoubleList list)
list
- List containing values to be added to this list.true
if this collection changed as a result of the call.NullPointerException
- If the specified list is null.public boolean addAll(ArrayDoubleList list, int offset, int length)
list
- List containing values to be added to this list.offset
- The index of the first value to add.length
- The number of values to add.true
if this collection changed as a result of the call.IndexOutOfBoundsException
- If the offset or length are out of range
(offset < 0 || values.length < offset + length
).NullPointerException
- If the specified list is null.public boolean addAll(double[] values, int offset, int length)
addAll
in interface DoubleList
values
- Array containing values to be added to this list.offset
- The index of the first value to add.length
- The number of values to add.true
if this list changed as a result of the call.IndexOutOfBoundsException
- If the offset or length are out of range
(offset < 0 || values.length < offset + length
).NullPointerException
- If the specified array is null.public boolean addAll(double... values)
addAll
in interface DoubleCollection
addAll
in interface DoubleList
values
- Array containing values to be added to this list.true
if this list changed as a result of the call.NullPointerException
- If the specified array is null.public boolean addAll(int index, ArrayDoubleList list, int offset, int length)
index
- Index at which to insert the first value from the specified
list.list
- List containing values to be added to this list.offset
- The index of the first value to add.length
- The number of values to add.true
if this collection changed as a result of the call.IndexOutOfBoundsException
- If the index is out of range.
(index < 0 || size() < index
).NullPointerException
- If the specified list is null.public boolean addAll(int index, ArrayDoubleList list)
index
- Index at which to insert the first value from the specified
list.list
- List containing values to be added to this list.true
if this collection changed as a result of the call.IndexOutOfBoundsException
- If the index is out of range
(index < 0 || size() < index
).NullPointerException
- If the specified list is null.public boolean addAll(int index, double[] values, int offset, int length)
DoubleList
addAll
in interface DoubleList
index
- Index at which to insert the first value from the specified
array.values
- Array containing values to be added to this list.offset
- The index of the first value to add.length
- The number of values to add.true
if this list changed as a result of the call.public boolean addAll(Collection<Double> c)
DoubleList
addAll
in interface DoubleCollection
addAll
in interface DoubleList
c
- Collection containing values to be added to this list.true
if this list changed as a result of the call.public boolean addAll(DoubleCollection c)
DoubleList
addAll
in interface DoubleCollection
addAll
in interface DoubleList
c
- Collection containing values to be added to this list.true
if this list changed as a result of the call.public boolean addAll(int index, Collection<Double> c)
DoubleList
addAll
in interface DoubleList
index
- Index at which to insert the first value from the specified
collection.c
- Collection containing values to be added to this list.true
if this list changed as a result of the call.public boolean addAll(int index, DoubleCollection c)
DoubleList
addAll
in interface DoubleList
index
- Index at which to insert the first value from the specified
collection.c
- Collection containing values to be added to this list.true
if this list changed as a result of the call.public double set(int index, double value)
DoubleList
set
in interface DoubleList
index
- Index of the value to replace.value
- Value to be stored at the specified position.public double removeIndex(int index)
DoubleList
removeIndex
in interface DoubleList
index
- The index of the value to be removed.public boolean retainAll(Collection<Double> c)
DoubleList
retainAll
in interface DoubleCollection
retainAll
in interface DoubleList
c
- Collection containing values to be retained in this list.true
if this list changed as a result of the call.DoubleList.remove(double)
,
DoubleList.contains(double)
public boolean retainAll(DoubleCollection c)
DoubleList
retainAll
in interface DoubleCollection
retainAll
in interface DoubleList
c
- Collection containing values to be retained in this list.true
if this list changed as a result of the call.DoubleList.remove(double)
,
DoubleList.contains(double)
public int indexOf(double value)
DoubleList
i
such that value == get(i)
, or -1 if
there is no such value.indexOf
in interface DoubleList
value
- Value to search for.public int lastIndexOf(double value)
DoubleList
i
such that value == get(i)
, or -1 if
there is no such value.lastIndexOf
in interface DoubleList
value
- Value to search for.public void sort(DoubleComparator c)
DoubleList
sort
in interface DoubleList
c
- The comparator to determine the order of the list.public void sort(Object[] p, DoubleComparator c)
DoubleList
This method will result in this and the specified paired list to be sorted in tandem.
For example, this
and p
are initialized to:
this: 6 8 9 7 4 0 2 3 1 5 p: g i j h e a c d b fAfter
sort(p)
is called:
this: 0 1 2 3 4 5 6 7 8 9 p: a b c d e f g h i j
sort
in interface DoubleList
p
- The paired array that is to be sorted in tandem with this list.c
- The comparator to determine the order of this and the paired array.public DoubleIterator iterator()
DoubleList
iterator
in interface DoubleIterable
iterator
in interface DoubleList
public DoubleListIterator listIterator(int index)
DoubleList
next
. An initial call to
previous
would return the value with the
specified index minus one.listIterator
in interface DoubleList
index
- Index of the first value to be returned from the double list
iterator (by a call to next
).public ArrayDoubleList subList(int fromIndex, int toIndex)
DoubleList
fromIndex
, inclusive, and toIndex
, exclusive. (If
fromIndex
and toIndex
are equal, the returned list is
empty). The returned list is backed by this list, so non-structural, or
structural, changes in the returned list are reflected in this list,
and vice-versa. The returned list supports all of the optional list
operations supported by this list.
This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:
list.subList(from, to).clear();
Similar idioms may be constructed for indexOf
and
lastIndexOf
, and all of the algorithms in the DoubleList
class can be applied to a subList.
The semantics of the list returned by this method are defined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. Structural modifications are those that change the size of this list.
fromIndex
of the sub-list, the range indexes of the sub-list will
increase by 1.fromIndex
of the sub-list, the range indexes of the sub-list will
reduce by 1.subList
in interface DoubleList
fromIndex
- Low endpoint (inclusive) of the subList.toIndex
- High endpoint (exclusive) of the subList.public double[] toArray(double[] a)
DoubleCollection
If the collection fits in the specified array with room to spare (i.e., the
array has more values than the collection), the value in the array
immediately following the end of the collection is set to 0
. (This
is useful in determining the length of the collection only if the
caller knows that the collection does not contain any 0
values).
toArray
in interface DoubleCollection
a
- The array into which the values of the collection are to be
stored. If the array is not big enough to store the values, a new
array is allocated.public Double[] toArray(Double[] a)
DoubleCollection
If the collection fits in the specified array with room to spare (i.e., the array has more values than the collection), the value in the array immediately following the end of the collection is set to null.
toArray
in interface DoubleCollection
a
- The array into which the values of the collection are to be
stored. If the array is not big enough to store the values, a new
array is allocated.public void trimToSize()
ArrayDoubleList
instance to be the list's
current size. An application can use this operation to minimize the storage
of an ArrayDoubleList
instance.public void ensureCapacity(int minCapacity)
ArrayDoubleList
instance, if
necessary, to ensure that it can hold at least the number of values
specified by the minimum capacity argument.minCapacity
- The desired minimum capacity.public Spliterator.OfDouble spliterator()
DoubleCollection
Spliterator.OfDouble
over the values in this collection.spliterator
in interface DoubleCollection
Spliterator.OfDouble
over the values in this collection.public DoubleStream stream()
DoubleCollection
DoubleStream
over the values in this collection.stream
in interface DoubleCollection
DoubleStream
over the values in this collection.public DoubleStream parallelStream()
DoubleCollection
DoubleStream
over the values in this
collection.parallelStream
in interface DoubleCollection
DoubleStream
over the values in this
collection.public ArrayDoubleList clone()
PrimitiveArrayList
clone
in class PrimitiveArrayList<double[]>
public int hashCode()
hashCode
in interface DoubleList
hashCode
in interface PrimitiveCollection
hashCode
in class Object
Object.equals(Object)
,
DoubleList.equals(Object)
public boolean equals(Object obj)
true
if and only if the specified object is also a
ArrayDoubleList
, both lists have the same size, and all corresponding
pairs of values in the two lists are equal. In other words, two
lists are defined to be equal if they contain the same values in the same
order.equals
in interface DoubleList
equals
in interface PrimitiveCollection
equals
in class Object
obj
- The object to be compared for equality with this list.true
if the specified object is equal to this list.Object.equals(Object)
,
IntSet.equals(Object)
,
IntList.equals(Object)
public String toString()
"[]"
). Adjacent
values are separated by the characters ", "
(comma and space).
Values are converted to strings as by String.valueOf(Object)
.Copyright © 2020 LibJ. All rights reserved.