public class ArrayDoubleList extends DoubleList.Base implements DoubleList, java.util.RandomAccess
DoubleList
backed by a double-array, supporting all DoubleList
-methods by modifying and/or replacing the
underlying array.DoubleList.Base
Constructor and Description |
---|
ArrayDoubleList()
Create a new mutable
ArrayDoubleList . |
ArrayDoubleList(double[] xs) |
ArrayDoubleList(DoubleCollection xs) |
ArrayDoubleList(int capacity)
Deprecated.
Use
withCapacity(int) instead. |
Modifier and Type | Method and Description |
---|---|
boolean |
addAllDoubles(double... xs) |
boolean |
addAllDoubles(DoubleCollection xs) |
boolean |
addAllDoublesAt(int index,
double... xs) |
boolean |
addAllDoublesAt(int index,
DoubleCollection xs) |
boolean |
addDouble(double x,
double precision) |
void |
addDoubleAt(int index,
double x) |
boolean |
addDoubleExactly(double x) |
int |
binarySearchExactly(double x) |
void |
clear() |
boolean |
containsDoubleExactly(double x) |
static ArrayDoubleList |
create()
Create a new empty mutable
ArrayDoubleList . |
static ArrayDoubleList |
create(double... xs)
Create a new mutable
ArrayDoubleList initialized with a copy of the given contents. |
void |
forEachDouble(java.util.function.DoubleConsumer consumer)
Performs the given action for each
double in this iterable. |
double |
getDouble(int index) |
int |
indexOfDoubleExactly(double x) |
boolean |
isEmpty() |
DoubleIterator |
iterator() |
int |
lastIndexOfDoubleExactly(double x) |
DoubleListIterator |
listIterator(int index) |
static ArrayDoubleList |
of(double... xs)
Deprecated.
Use
create(double...) instead. |
boolean |
removeAllDoubles(double[] xs,
double precision) |
boolean |
removeAllDoublesExactly(double... xs) |
boolean |
removeDouble(double x,
double precision) |
double |
removeDoubleAt(int index) |
boolean |
removeDoubleExactly(double x) |
boolean |
removeDoublesIf(java.util.function.DoublePredicate filter) |
void |
replaceAllDoubles(java.util.function.DoubleUnaryOperator operator) |
boolean |
retainAllDoubles(double[] xs,
double precision) |
boolean |
retainAllDoublesExactly(double... xs) |
double |
setDouble(int index,
double x) |
int |
size() |
void |
sortDoubles() |
java.util.Spliterator.OfDouble |
spliterator() |
DoubleList |
subList(int from,
int to) |
double[] |
toDoubleArray()
Collect the
doubles in this DoubleCollection into an double -array. |
protected void |
uncheckedAdd(int index,
DoubleIterable xs,
int xsSize) |
static ArrayDoubleList |
withCapacity(int capacity) |
equals, hashCode
toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, add, addAll, addAll, contains, containsAll, copy, get, indexOf, indexOfDouble, lastIndexOf, lastIndexOfDouble, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, sort, sortDoubles, toArray, toArray
addDouble
containsAllDoubles, containsAllDoubles, containsAllDoublesExactly, containsAllDoublesExactly, containsAnyDoubles, containsAnyDoubles, containsAnyDoublesExactly, containsAnyDoublesExactly, containsDouble, doubleStream, forEach, from, from, once, once, parallelDoubleStream, removeAllDoubles, removeAllDoublesExactly, retainAllDoubles, retainAllDoublesExactly, sequence
public ArrayDoubleList()
ArrayDoubleList
.@Deprecated public ArrayDoubleList(int capacity)
withCapacity(int)
instead.ArrayDoubleList
with the given initial capacity.public ArrayDoubleList(DoubleCollection xs)
public ArrayDoubleList(double[] xs)
@Deprecated public static ArrayDoubleList of(double... xs)
create(double...)
instead.DoubleList
DoubleList
of the given elements. The returned DoubleList
's
DoubleListIterator
supports forward iteration only.of
in interface DoubleIterable
of
in interface DoubleList
ArrayDoubleList
initialized with a copy of the given contents.public static ArrayDoubleList create()
ArrayDoubleList
. When possible, it's preferred to use
DoubleList.create()
instead.create
in interface DoubleList
ArrayDoubleList
.DoubleList.create()
,
withCapacity(int)
public static ArrayDoubleList create(double... xs)
ArrayDoubleList
initialized with a copy of the given contents. When possible, it's
preferred to use DoubleList.create(double...)
instead.create
in interface DoubleList
ArrayDoubleList
initialized with a copy of the given contents.DoubleList.create(double...)
,
ArrayDoubleList(DoubleCollection)
public static ArrayDoubleList withCapacity(int capacity)
ArrayDoubleList
with the given initial capacity.public int size()
size
in interface java.util.Collection<java.lang.Double>
size
in interface java.util.List<java.lang.Double>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<java.lang.Double>
isEmpty
in interface java.util.List<java.lang.Double>
isEmpty
in interface DoubleCollection
isEmpty
in interface DoubleIterable
isEmpty
in interface DoubleList
public void clear()
clear
in interface java.util.Collection<java.lang.Double>
clear
in interface java.util.List<java.lang.Double>
clear
in interface DoubleCollection
clear
in interface DoubleIterable
clear
in interface DoubleList
public double[] toDoubleArray()
DoubleCollection
doubles
in this DoubleCollection
into an double
-array.toDoubleArray
in interface DoubleCollection
public DoubleIterator iterator()
iterator
in interface java.lang.Iterable<java.lang.Double>
iterator
in interface java.util.Collection<java.lang.Double>
iterator
in interface java.util.List<java.lang.Double>
iterator
in interface DoubleIterable
public DoubleListIterator listIterator(int index)
listIterator
in interface java.util.List<java.lang.Double>
listIterator
in interface DoubleList
public void sortDoubles()
sortDoubles
in interface DoubleList
public int binarySearchExactly(double x)
binarySearchExactly
in interface DoubleList
public DoubleList subList(int from, int to)
subList
in interface java.util.List<java.lang.Double>
subList
in interface DoubleList
public void replaceAllDoubles(java.util.function.DoubleUnaryOperator operator)
replaceAllDoubles
in interface DoubleList
public double getDouble(int index)
getDouble
in interface DoubleList
public double setDouble(int index, double x)
setDouble
in interface DoubleList
public void addDoubleAt(int index, double x)
addDoubleAt
in interface DoubleList
public double removeDoubleAt(int index)
removeDoubleAt
in interface DoubleList
public int lastIndexOfDoubleExactly(double x)
lastIndexOfDoubleExactly
in interface DoubleList
public int indexOfDoubleExactly(double x)
indexOfDoubleExactly
in interface DoubleList
public java.util.Spliterator.OfDouble spliterator()
spliterator
in interface java.lang.Iterable<java.lang.Double>
spliterator
in interface java.util.Collection<java.lang.Double>
spliterator
in interface java.util.List<java.lang.Double>
spliterator
in interface DoubleCollection
spliterator
in interface DoubleIterable
spliterator
in interface DoubleList
public boolean addDoubleExactly(double x)
addDoubleExactly
in interface DoubleCollection
addDoubleExactly
in interface DoubleList
DoubleCollection.addDouble(double, double)
public boolean addDouble(double x, double precision)
addDouble
in interface DoubleCollection
addDouble
in interface DoubleList
DoubleCollection.addDoubleExactly(double)
public boolean addAllDoubles(double... xs)
addAllDoubles
in interface DoubleCollection
addAllDoubles
in interface DoubleList
public boolean addAllDoubles(DoubleCollection xs)
addAllDoubles
in interface DoubleCollection
addAllDoubles
in interface DoubleList
public boolean addAllDoublesAt(int index, double... xs)
addAllDoublesAt
in interface DoubleList
public boolean addAllDoublesAt(int index, DoubleCollection xs)
addAllDoublesAt
in interface DoubleList
public boolean removeDouble(double x, double precision)
removeDouble
in interface DoubleIterable
public boolean removeDoubleExactly(double x)
removeDoubleExactly
in interface DoubleIterable
public boolean containsDoubleExactly(double x)
containsDoubleExactly
in interface DoubleIterable
public boolean removeAllDoubles(double[] xs, double precision)
removeAllDoubles
in interface DoubleIterable
public boolean removeAllDoublesExactly(double... xs)
removeAllDoublesExactly
in interface DoubleIterable
public boolean retainAllDoubles(double[] xs, double precision)
retainAllDoubles
in interface DoubleIterable
public boolean retainAllDoublesExactly(double... xs)
retainAllDoublesExactly
in interface DoubleIterable
public boolean removeDoublesIf(java.util.function.DoublePredicate filter)
removeDoublesIf
in interface DoubleIterable
public void forEachDouble(java.util.function.DoubleConsumer consumer)
DoubleIterable
double
in this iterable.forEachDouble
in interface DoubleIterable
protected void uncheckedAdd(int index, DoubleIterable xs, int xsSize)