public static class AbstractDoubleList.DoubleSubList extends AbstractDoubleList implements java.io.Serializable
AbstractDoubleList.DoubleRandomAccessSubList, AbstractDoubleList.DoubleSubList
Constructor and Description |
---|
DoubleSubList(DoubleList l,
int from,
int to) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(double k)
Ensures that this collection contains the specified element (optional operation).
|
void |
add(int index,
double k)
Inserts the specified element at the specified position in this list (optional operation).
|
boolean |
addAll(int index,
java.util.Collection<? extends java.lang.Double> c)
Adds all of the elements in the specified collection to this list (optional operation).
|
boolean |
addAll(int index,
DoubleCollection c)
Inserts all of the elements in the specified type-specific collection into this type-specific list at the specified position (optional operation).
|
boolean |
addAll(int index,
DoubleList l)
Inserts all of the elements in the specified type-specific list into this type-specific list at the specified position (optional operation).
|
void |
addElements(int index,
double[] a,
int offset,
int length)
Add (hopefully quickly) elements to this type-specific list.
|
double |
getDouble(int index)
Returns the element at the specified position in this list.
|
void |
getElements(int from,
double[] a,
int offset,
int length)
Copies (hopefully quickly) elements of this type-specific list into the given array.
|
DoubleListIterator |
listIterator(int index)
Returns a type-specific list iterator on the list starting at a given index.
|
boolean |
rem(double k)
Removes a single instance of the specified element from this collection, if it is present (optional operation).
|
double |
removeDouble(int index)
Removes the element at the specified position in this list (optional operation).
|
void |
removeElements(int from,
int to)
Removes (hopefully quickly) elements of this type-specific list.
|
double |
set(int index,
double k)
Replaces the element at the specified position in this list with the specified element (optional operation).
|
void |
setElements(int index,
double[] a,
int offset,
int length)
Set (hopefully quickly) elements to match the array given.
|
int |
size() |
DoubleSpliterator |
spliterator()
Returns a type-specific spliterator on the elements 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. |
addAll, addAll, addElements, clear, compareTo, contains, equals, forEach, hashCode, indexOf, iterator, lastIndexOf, listIterator, peekDouble, popDouble, push, replaceAll, size, toArray, toDoubleArray, topDouble, toString
add, contains, containsAll, containsAll, forEach, remove, removeAll, removeAll, removeIf, retainAll, retainAll, toDoubleArray
add, add, addAll, contains, get, indexOf, lastIndexOf, of, of, of, of, of, remove, remove, replaceAll, replaceAll, set, setElements, setElements, sort, sort, unstableSort, unstableSort
containsAll, isEmpty, removeAll, retainAll, toArray, toArray
containsAll, doubleIterator, doubleParallelStream, doubleSpliterator, doubleStream, parallelStream, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toDoubleArray
forEach, forEach
peek, pop, push, top
public DoubleSubList(DoubleList l, int from, int to)
public boolean add(double k)
AbstractDoubleList
add
in interface DoubleCollection
add
in interface DoubleList
add
in class AbstractDoubleList
Collection.add(Object)
public void add(int index, double k)
AbstractDoubleList
add
in interface DoubleList
add
in class AbstractDoubleList
List.add(int,Object)
public boolean addAll(int index, java.util.Collection<? extends java.lang.Double> c)
AbstractDoubleList
addAll
in interface java.util.List<java.lang.Double>
addAll
in class AbstractDoubleList
public double getDouble(int index)
DoubleList
getDouble
in interface DoubleList
List.get(int)
public double removeDouble(int index)
AbstractDoubleList
removeDouble
in interface DoubleList
removeDouble
in class AbstractDoubleList
List.remove(int)
public double set(int index, double k)
AbstractDoubleList
set
in interface DoubleList
set
in class AbstractDoubleList
List.set(int,Object)
public int size()
size
in interface java.util.Collection<java.lang.Double>
size
in interface java.util.List<java.lang.Double>
size
in class java.util.AbstractCollection<java.lang.Double>
public void getElements(int from, double[] a, int offset, int length)
AbstractDoubleList
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
getElements
in class AbstractDoubleList
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 void removeElements(int from, int to)
AbstractDoubleList
This is a trivial iterator-based based implementation. It is expected that implementations will override this method with a more optimized version.
removeElements
in interface DoubleList
removeElements
in class AbstractDoubleList
from
- the start index (inclusive).to
- the end index (exclusive).public void addElements(int index, double[] a, int offset, int length)
AbstractDoubleList
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
addElements
in class AbstractDoubleList
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 setElements(int index, double[] a, int offset, int length)
DoubleList
ListIterator iter = listIterator(index);
int i = 0;
while (i < length) {
iter.next();
iter.set(a[offset + i++]);
}
However, the exact implementation may be more efficient, taking into account
whether random access is faster or not, or at the discretion of subclasses,
abuse internals.setElements
in interface DoubleList
setElements
in class AbstractDoubleList
index
- the index at which to start setting elements.a
- the array containing the elementsoffset
- the offset of the first element to add.length
- the number of elements to add.public DoubleListIterator listIterator(int index)
AbstractDoubleList
listIterator
in interface DoubleList
listIterator
in interface java.util.List<java.lang.Double>
listIterator
in class AbstractDoubleList
List.listIterator(int)
public DoubleSpliterator spliterator()
DoubleList
List spliterators must report at least Spliterator.SIZED
and Spliterator.ORDERED
.
See List.spliterator()
for more documentation on the requirements
of the returned spliterator.
spliterator
in interface DoubleCollection
spliterator
in interface DoubleIterable
spliterator
in interface DoubleList
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>
public DoubleList subList(int from, int to)
DoubleList
from
, inclusive, to the index to
, exclusive.subList
in interface DoubleList
subList
in interface java.util.List<java.lang.Double>
subList
in class AbstractDoubleList
List.subList(int,int)
public boolean rem(double k)
AbstractDoubleList
rem
in interface DoubleCollection
rem
in class AbstractDoubleList
List.remove(Object)
public boolean addAll(int index, DoubleCollection c)
DoubleList
addAll
in interface DoubleList
addAll
in class AbstractDoubleList
List.addAll(int,java.util.Collection)
public boolean addAll(int index, DoubleList l)
DoubleList
addAll
in interface DoubleList
List.addAll(int,Collection)