public abstract class AbstractDoubleList extends AbstractDoubleCollection implements DoubleList, DoubleStack
As an additional bonus, this class implements on top of the list operations a type-specific stack.
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractDoubleList.DoubleSubList |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(double k) |
void |
add(int index,
double k) |
void |
add(int index,
Double ok)
Delegates to the corresponding type-specific method.
|
boolean |
addAll(Collection<? extends Double> c)
Delegates to a more generic method.
|
boolean |
addAll(DoubleCollection c)
Adds all elements of the given type-specific collection to this collection.
|
boolean |
addAll(DoubleList l) |
boolean |
addAll(int index,
Collection<? extends Double> c) |
boolean |
addAll(int index,
DoubleCollection c)
Delegates to a more generic method.
|
boolean |
addAll(int index,
DoubleList l)
Delegates to a more generic method.
|
void |
addElements(int index,
double[] a)
Add (hopefully quickly) elements to this type-specific list.
|
void |
addElements(int index,
double[] a,
int offset,
int length)
Adds elements to this type-specific list one-by-one.
|
int |
compareTo(List<? extends Double> l)
Compares this list to another object.
|
boolean |
contains(double k) |
DoubleListIterator |
doubleListIterator()
Deprecated.
|
DoubleListIterator |
doubleListIterator(int index)
Deprecated.
|
DoubleList |
doubleSubList(int from,
int to)
Deprecated.
|
boolean |
equals(Object o) |
Double |
get(int index)
Delegates to the corresponding type-specific method.
|
void |
getElements(int from,
double[] a,
int offset,
int length)
Copies element of this type-specific list into the given array one-by-one.
|
int |
hashCode()
Returns the hash code for this list, which is identical to
List.hashCode(). |
int |
indexOf(double k) |
int |
indexOf(Object ok)
Delegates to the corresponding type-specific method.
|
DoubleListIterator |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
int |
lastIndexOf(double k) |
int |
lastIndexOf(Object ok)
Delegates to the corresponding type-specific method.
|
DoubleListIterator |
listIterator()
Returns a type-specific list iterator on the list.
|
DoubleListIterator |
listIterator(int index)
Returns a type-specific list iterator on the list starting at a given index.
|
Double |
peek(int i)
Delegates to the corresponding type-specific method.
|
double |
peekDouble(int i) |
Double |
pop()
Delegates to the corresponding type-specific method.
|
double |
popDouble() |
void |
push(double o) |
void |
push(Double o)
Delegates to the corresponding type-specific method.
|
boolean |
rem(double k)
|
Double |
remove(int index)
Delegates to the corresponding type-specific method.
|
boolean |
remove(Object o)
Delegates to
rem(). |
double |
removeDouble(int i) |
void |
removeElements(int from,
int to)
Removes elements of this type-specific list one-by-one.
|
double |
set(int index,
double k) |
Double |
set(int index,
Double ok)
Delegates to the corresponding type-specific method.
|
void |
size(int size)
Sets the size of this list.
|
DoubleList |
subList(int from,
int to)
Returns a type-specific view of the portion of this list from the index
from, inclusive, to the index to, exclusive. |
Double |
top()
Delegates to the corresponding type-specific method.
|
double |
topDouble() |
String |
toString() |
add, contains, containsAll, containsAll, doubleIterator, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toDoubleArray, toDoubleArrayclear, sizegetDoubleadd, clear, contains, containsAll, isEmpty, removeAll, replaceAll, retainAll, size, sort, spliterator, toArray, toArraycontainsAll, doubleIterator, removeAll, retainAll, toArray, toArray, toDoubleArray, toDoubleArrayparallelStream, removeIf, streampublic void add(int index,
double k)
add in interface DoubleListList.add(int,Object)public boolean add(double k)
add in interface DoubleCollectionadd in interface DoubleListadd in class AbstractDoubleCollectionCollection.add(Object)public double removeDouble(int i)
removeDouble in interface DoubleListList.remove(int)public double set(int index,
double k)
set in interface DoubleListList.set(int,Object)public boolean addAll(int index,
Collection<? extends Double> c)
public boolean addAll(Collection<? extends Double> c)
addAll in interface Collection<Double>addAll in interface List<Double>addAll in class AbstractDoubleCollectionc - a collection.true if this collection changed as a result of the call.@Deprecated public DoubleListIterator doubleListIterator()
doubleListIterator in interface DoubleListDoubleList.listIterator()@Deprecated public DoubleListIterator doubleListIterator(int index)
doubleListIterator in interface DoubleListDoubleList.listIterator(int)public DoubleListIterator iterator()
DoubleCollectionNote that this specification strengthens the one given in Iterable.iterator(), which was already strengthened in the corresponding type-specific class, but was weakened by
the fact that this interface extends Collection.
iterator in interface DoubleCollectioniterator in interface DoubleIterableiterator in interface DoubleListiterator in interface Iterable<Double>iterator in interface Collection<Double>iterator in interface List<Double>iterator in class AbstractDoubleCollectionpublic DoubleListIterator listIterator()
DoubleListlistIterator in interface DoubleListlistIterator in interface List<Double>List.listIterator()public DoubleListIterator listIterator(int index)
DoubleListlistIterator in interface DoubleListlistIterator in interface List<Double>List.listIterator(int)public boolean contains(double k)
contains in interface DoubleCollectioncontains in class AbstractDoubleCollectionCollection.contains(Object)public int indexOf(double k)
indexOf in interface DoubleListList.indexOf(Object)public int lastIndexOf(double k)
lastIndexOf in interface DoubleListList.lastIndexOf(Object)public void size(int size)
DoubleListIf the specified size is smaller than the current size, the last elements are discarded. Otherwise, they are filled with 0/null/false.
size in interface DoubleListsize - the new size.public DoubleList subList(int from, int to)
DoubleListfrom, inclusive, to the index to, exclusive.
Note that this specification strengthens the one given in List.subList(int,int).
subList in interface DoubleListsubList in interface List<Double>List.subList(int,int)@Deprecated public DoubleList doubleSubList(int from, int to)
doubleSubList in interface DoubleListList.subList(int,int)public void removeElements(int from,
int to)
This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
removeElements in interface DoubleListfrom - the start index (inclusive).to - the end index (exclusive).public void addElements(int index,
double[] a,
int offset,
int length)
This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
addElements in interface DoubleListindex - the index at which to add elements.a - the array containing the elements.offset - the offset of the first element to add.length - the number of elements to add.public void addElements(int index,
double[] a)
DoubleListaddElements in interface DoubleListindex - the index at which to add elements.a - the array containing the elements.public void getElements(int from,
double[] a,
int offset,
int length)
This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
getElements in interface DoubleListfrom - the start index (inclusive).a - the destination array.offset - the offset into the destination array where to store the first element copied.length - the number of elements to be copied.public boolean equals(Object o)
public int compareTo(List<? extends Double> l)
List, this method performs a lexicographical comparison; otherwise, it throws a ClassCastException.compareTo in interface Comparable<List<? extends Double>>l - a list.List, a negative integer, zero, or a positive integer as this list is lexicographically less than, equal to, or greater than the argument.ClassCastException - if the argument is not a list.public int hashCode()
List.hashCode().public void push(double o)
push in interface DoubleStackStack.push(Object)public double popDouble()
popDouble in interface DoubleStackStack.pop()public double topDouble()
topDouble in interface DoubleStackStack.top()public double peekDouble(int i)
peekDouble in interface DoubleStackStack.peek(int)public boolean rem(double k)
DoubleCollectionremove(), but the clash with the similarly named index-based method in the List interface
forces us to use a distinguished name. For simplicity, the set interfaces reinstates remove().rem in interface DoubleCollectionrem in class AbstractDoubleCollectionCollection.remove(Object)public boolean remove(Object o)
rem().remove in interface Collection<Double>remove in interface List<Double>remove in class AbstractDoubleCollectionpublic boolean addAll(int index,
DoubleCollection c)
addAll in interface DoubleListList.add(int,Object)public boolean addAll(int index,
DoubleList l)
addAll in interface DoubleListList.add(int,Object)public boolean addAll(DoubleCollection c)
AbstractDoubleCollectionaddAll in interface DoubleCollectionaddAll in class AbstractDoubleCollectionc - a type-specific collection.true if this collection changed as a result of the call.Collection.addAll(Collection)public boolean addAll(DoubleList l)
addAll in interface DoubleListList.add(int,Object)public void add(int index,
Double ok)
public Double get(int index)
public int indexOf(Object ok)
public int lastIndexOf(Object ok)
lastIndexOf in interface List<Double>public Double remove(int index)
public void push(Double o)
public Double pop()
public Double top()
public Double peek(int i)
public String toString()
toString in class AbstractDoubleCollection