public static class AbstractShortList.ShortSubList extends AbstractShortList implements java.io.Serializable
AbstractShortList.ShortRandomAccessSubList, AbstractShortList.ShortSubList
Constructor and Description |
---|
ShortSubList(ShortList l,
int from,
int to) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
short k)
Inserts the specified element at the specified position in this list (optional operation).
|
boolean |
add(short k)
Ensures that this collection contains the specified element (optional operation).
|
boolean |
addAll(int index,
java.util.Collection<? extends java.lang.Short> c)
Adds all of the elements in the specified collection to this list (optional operation).
|
boolean |
addAll(int index,
ShortCollection 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,
ShortList 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,
short[] a,
int offset,
int length)
Add (hopefully quickly) elements to this type-specific list.
|
void |
getElements(int from,
short[] a,
int offset,
int length)
Copies (hopefully quickly) elements of this type-specific list into the given array.
|
short |
getShort(int index)
Returns the element at the specified position in this list.
|
ShortListIterator |
listIterator(int index)
Returns a type-specific list iterator on the list starting at a given index.
|
boolean |
rem(short k)
Removes a single instance of the specified element from this collection, if it is present (optional operation).
|
void |
removeElements(int from,
int to)
Removes (hopefully quickly) elements of this type-specific list.
|
short |
removeShort(int index)
Removes the element at the specified position in this list (optional operation).
|
short |
set(int index,
short k)
Replaces the element at the specified position in this list with the specified element (optional operation).
|
void |
setElements(int index,
short[] a,
int offset,
int length)
Set (hopefully quickly) elements to match the array given.
|
int |
size() |
ShortSpliterator |
spliterator()
Returns a type-specific spliterator on the elements of this list.
|
ShortList |
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, peekShort, popShort, push, size, toArray, topShort, toShortArray, toString
add, contains, containsAll, containsAll, remove, removeAll, removeAll, retainAll, retainAll, toShortArray
add, add, addAll, contains, get, indexOf, lastIndexOf, of, of, of, of, of, remove, remove, replaceAll, replaceAll, replaceAll, set, setElements, setElements, sort, sort, unstableSort, unstableSort
containsAll, isEmpty, removeAll, retainAll, toArray, toArray
containsAll, intIterator, intParallelStream, intSpliterator, intStream, parallelStream, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toShortArray
forEach, forEach
peek, pop, push, top
public ShortSubList(ShortList l, int from, int to)
public boolean add(short k)
AbstractShortList
add
in interface ShortCollection
add
in interface ShortList
add
in class AbstractShortList
Collection.add(Object)
public void add(int index, short k)
AbstractShortList
add
in interface ShortList
add
in class AbstractShortList
List.add(int,Object)
public boolean addAll(int index, java.util.Collection<? extends java.lang.Short> c)
AbstractShortList
addAll
in interface java.util.List<java.lang.Short>
addAll
in class AbstractShortList
public short getShort(int index)
ShortList
public short removeShort(int index)
AbstractShortList
removeShort
in interface ShortList
removeShort
in class AbstractShortList
List.remove(int)
public short set(int index, short k)
AbstractShortList
set
in interface ShortList
set
in class AbstractShortList
List.set(int,Object)
public int size()
size
in interface java.util.Collection<java.lang.Short>
size
in interface java.util.List<java.lang.Short>
size
in class java.util.AbstractCollection<java.lang.Short>
public void getElements(int from, short[] a, int offset, int length)
AbstractShortList
This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
getElements
in interface ShortList
getElements
in class AbstractShortList
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)
AbstractShortList
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 ShortList
removeElements
in class AbstractShortList
from
- the start index (inclusive).to
- the end index (exclusive).public void addElements(int index, short[] a, int offset, int length)
AbstractShortList
This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
addElements
in interface ShortList
addElements
in class AbstractShortList
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, short[] a, int offset, int length)
ShortList
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 ShortList
setElements
in class AbstractShortList
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 ShortListIterator listIterator(int index)
AbstractShortList
listIterator
in interface ShortList
listIterator
in interface java.util.List<java.lang.Short>
listIterator
in class AbstractShortList
List.listIterator(int)
public ShortSpliterator spliterator()
ShortList
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 ShortCollection
spliterator
in interface ShortIterable
spliterator
in interface ShortList
spliterator
in interface java.lang.Iterable<java.lang.Short>
spliterator
in interface java.util.Collection<java.lang.Short>
spliterator
in interface java.util.List<java.lang.Short>
public ShortList subList(int from, int to)
ShortList
from
, inclusive, to the index to
, exclusive.subList
in interface ShortList
subList
in interface java.util.List<java.lang.Short>
subList
in class AbstractShortList
List.subList(int,int)
public boolean rem(short k)
AbstractShortList
rem
in interface ShortCollection
rem
in class AbstractShortList
List.remove(Object)
public boolean addAll(int index, ShortCollection c)
ShortList
addAll
in interface ShortList
addAll
in class AbstractShortList
List.addAll(int,java.util.Collection)