public static class AbstractByteList.ByteSubList extends AbstractByteList implements java.io.Serializable
AbstractByteList.ByteRandomAccessSubList, AbstractByteList.ByteSubList
Constructor and Description |
---|
ByteSubList(ByteList l,
int from,
int to) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(byte k)
Ensures that this collection contains the specified element (optional operation).
|
void |
add(int index,
byte k)
Inserts the specified element at the specified position in this list (optional operation).
|
boolean |
addAll(int index,
ByteCollection 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,
ByteList l)
Inserts all of the elements in the specified type-specific list into this type-specific list at the specified position (optional operation).
|
boolean |
addAll(int index,
java.util.Collection<? extends java.lang.Byte> c)
Adds all of the elements in the specified collection to this list (optional operation).
|
void |
addElements(int index,
byte[] a,
int offset,
int length)
Add (hopefully quickly) elements to this type-specific list.
|
byte |
getByte(int index)
Returns the element at the specified position in this list.
|
void |
getElements(int from,
byte[] a,
int offset,
int length)
Copies (hopefully quickly) elements of this type-specific list into the given array.
|
ByteListIterator |
listIterator(int index)
Returns a type-specific list iterator on the list starting at a given index.
|
boolean |
rem(byte k)
Removes a single instance of the specified element from this collection, if it is present (optional operation).
|
byte |
removeByte(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.
|
byte |
set(int index,
byte k)
Replaces the element at the specified position in this list with the specified element (optional operation).
|
void |
setElements(int index,
byte[] a,
int offset,
int length)
Set (hopefully quickly) elements to match the array given.
|
int |
size() |
ByteSpliterator |
spliterator()
Returns a type-specific spliterator on the elements of this list.
|
ByteList |
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, peekByte, popByte, push, size, toArray, toByteArray, topByte, toString
add, contains, containsAll, containsAll, remove, removeAll, removeAll, retainAll, retainAll, toByteArray
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, toByteArray
forEach, forEach
public ByteSubList(ByteList l, int from, int to)
public boolean add(byte k)
AbstractByteList
add
in interface ByteCollection
add
in interface ByteList
add
in class AbstractByteList
Collection.add(Object)
public void add(int index, byte k)
AbstractByteList
add
in interface ByteList
add
in class AbstractByteList
List.add(int,Object)
public boolean addAll(int index, java.util.Collection<? extends java.lang.Byte> c)
AbstractByteList
addAll
in interface java.util.List<java.lang.Byte>
addAll
in class AbstractByteList
public byte getByte(int index)
ByteList
public byte removeByte(int index)
AbstractByteList
removeByte
in interface ByteList
removeByte
in class AbstractByteList
List.remove(int)
public byte set(int index, byte k)
AbstractByteList
set
in interface ByteList
set
in class AbstractByteList
List.set(int,Object)
public int size()
size
in interface java.util.Collection<java.lang.Byte>
size
in interface java.util.List<java.lang.Byte>
size
in class java.util.AbstractCollection<java.lang.Byte>
public void getElements(int from, byte[] a, int offset, int length)
AbstractByteList
This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
getElements
in interface ByteList
getElements
in class AbstractByteList
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)
AbstractByteList
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 ByteList
removeElements
in class AbstractByteList
from
- the start index (inclusive).to
- the end index (exclusive).public void addElements(int index, byte[] a, int offset, int length)
AbstractByteList
This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
addElements
in interface ByteList
addElements
in class AbstractByteList
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, byte[] a, int offset, int length)
ByteList
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 ByteList
setElements
in class AbstractByteList
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 ByteListIterator listIterator(int index)
AbstractByteList
listIterator
in interface ByteList
listIterator
in interface java.util.List<java.lang.Byte>
listIterator
in class AbstractByteList
List.listIterator(int)
public ByteSpliterator spliterator()
ByteList
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 ByteCollection
spliterator
in interface ByteIterable
spliterator
in interface ByteList
spliterator
in interface java.lang.Iterable<java.lang.Byte>
spliterator
in interface java.util.Collection<java.lang.Byte>
spliterator
in interface java.util.List<java.lang.Byte>
public ByteList subList(int from, int to)
ByteList
from
, inclusive, to the index to
, exclusive.subList
in interface ByteList
subList
in interface java.util.List<java.lang.Byte>
subList
in class AbstractByteList
List.subList(int,int)
public boolean rem(byte k)
AbstractByteList
rem
in interface ByteCollection
rem
in class AbstractByteList
List.remove(Object)
public boolean addAll(int index, ByteCollection c)
ByteList
addAll
in interface ByteList
addAll
in class AbstractByteList
List.addAll(int,java.util.Collection)