|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<Double>
it.unimi.dsi.fastutil.doubles.AbstractDoubleCollection
it.unimi.dsi.fastutil.doubles.AbstractDoubleList
public abstract class AbstractDoubleList
An abstract class providing basic methods for lists implementing a type-specific list interface.
As an additional bonus, this class implements on top of the list operations a type-specific stack.
Nested Class Summary | |
---|---|
static class |
AbstractDoubleList.DoubleSubList
|
Method Summary | |
---|---|
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)
Note that this method should be called remove() , but the clash
with the similarly named index-based method in the List interface
forces us to use a distinguished name. |
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()
|
Methods inherited from class it.unimi.dsi.fastutil.doubles.AbstractDoubleCollection |
---|
add, contains, containsAll, containsAll, doubleIterator, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toDoubleArray, toDoubleArray |
Methods inherited from class java.util.AbstractCollection |
---|
clear, size |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface it.unimi.dsi.fastutil.doubles.DoubleList |
---|
getDouble |
Methods inherited from interface java.util.List |
---|
add, clear, contains, containsAll, isEmpty, removeAll, retainAll, size, toArray, toArray |
Methods inherited from interface it.unimi.dsi.fastutil.doubles.DoubleCollection |
---|
containsAll, doubleIterator, removeAll, retainAll, toArray, toArray, toDoubleArray, toDoubleArray |
Methods inherited from interface it.unimi.dsi.fastutil.Stack |
---|
isEmpty |
Method Detail |
---|
public void add(int index, double k)
add
in interface DoubleList
List.add(int,Object)
public boolean add(double k)
add
in interface DoubleCollection
add
in interface DoubleList
add
in class AbstractDoubleCollection
Collection.add(Object)
public double removeDouble(int i)
removeDouble
in interface DoubleList
List.remove(int)
public double set(int index, double k)
set
in interface DoubleList
List.set(int,Object)
public boolean addAll(int index, Collection<? extends Double> c)
addAll
in interface List<Double>
public boolean addAll(Collection<? extends Double> c)
addAll
in interface Collection<Double>
addAll
in interface List<Double>
addAll
in class AbstractDoubleCollection
c
- a collection.
true
if this collection changed as a result of the call.@Deprecated public DoubleListIterator doubleListIterator()
doubleListIterator
in interface DoubleList
DoubleList.listIterator()
@Deprecated public DoubleListIterator doubleListIterator(int index)
doubleListIterator
in interface DoubleList
DoubleList.listIterator(int)
public DoubleListIterator iterator()
DoubleCollection
Note 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 DoubleCollection
iterator
in interface DoubleIterable
iterator
in interface DoubleList
iterator
in interface Iterable<Double>
iterator
in interface Collection<Double>
iterator
in interface List<Double>
iterator
in class AbstractDoubleCollection
public DoubleListIterator listIterator()
DoubleList
listIterator
in interface DoubleList
listIterator
in interface List<Double>
List.listIterator()
public DoubleListIterator listIterator(int index)
DoubleList
listIterator
in interface DoubleList
listIterator
in interface List<Double>
List.listIterator(int)
public boolean contains(double k)
contains
in interface DoubleCollection
contains
in class AbstractDoubleCollection
Collection.contains(Object)
public int indexOf(double k)
indexOf
in interface DoubleList
List.indexOf(Object)
public int lastIndexOf(double k)
lastIndexOf
in interface DoubleList
List.lastIndexOf(Object)
public void size(int size)
DoubleList
If 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 DoubleList
size
- the new size.public DoubleList subList(int from, int to)
DoubleList
from
, inclusive, to the index to
, exclusive.
Note that this specification strengthens the one given in List.subList(int,int)
.
subList
in interface DoubleList
subList
in interface List<Double>
List.subList(int,int)
@Deprecated public DoubleList doubleSubList(int from, int to)
doubleSubList
in interface DoubleList
List.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 DoubleList
from
- 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 DoubleList
index
- 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)
DoubleList
addElements
in interface DoubleList
index
- 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 DoubleList
from
- 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)
equals
in interface Collection<Double>
equals
in interface List<Double>
equals
in class Object
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()
.
hashCode
in interface Collection<Double>
hashCode
in interface List<Double>
hashCode
in class Object
public void push(double o)
push
in interface DoubleStack
Stack.push(Object)
public double popDouble()
popDouble
in interface DoubleStack
Stack.pop()
public double topDouble()
topDouble
in interface DoubleStack
Stack.top()
public double peekDouble(int i)
peekDouble
in interface DoubleStack
Stack.peek(int)
public boolean rem(double k)
DoubleCollection
remove()
, 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 DoubleCollection
rem
in class AbstractDoubleCollection
Collection.remove(Object)
public boolean remove(Object o)
rem()
.
remove
in interface Collection<Double>
remove
in interface List<Double>
remove
in class AbstractDoubleCollection
public boolean addAll(int index, DoubleCollection c)
addAll
in interface DoubleList
List.add(int,Object)
public boolean addAll(int index, DoubleList l)
addAll
in interface DoubleList
List.add(int,Object)
public boolean addAll(DoubleCollection c)
AbstractDoubleCollection
addAll
in interface DoubleCollection
addAll
in class AbstractDoubleCollection
c
- 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 DoubleList
List.add(int,Object)
public void add(int index, Double ok)
add
in interface List<Double>
public Double set(int index, Double ok)
set
in interface List<Double>
public Double get(int index)
get
in interface List<Double>
public int indexOf(Object ok)
indexOf
in interface List<Double>
public int lastIndexOf(Object ok)
lastIndexOf
in interface List<Double>
public Double remove(int index)
remove
in interface List<Double>
public void push(Double o)
push
in interface Stack<Double>
o
- the object that will become the new top of the stack.public Double pop()
pop
in interface Stack<Double>
public Double top()
top
in interface Stack<Double>
public Double peek(int i)
peek
in interface Stack<Double>
i
-th element on the stack; 0 represents the top.public String toString()
toString
in class AbstractDoubleCollection
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |