public static class AbstractReferenceList.ReferenceSubList<K> extends AbstractReferenceList<K> implements Serializable
AbstractReferenceList.ReferenceSubList<K>| Constructor and Description |
|---|
ReferenceSubList(ReferenceList<K> l,
int from,
int to) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
K k)
Inserts the specified element at the specified position in this list
(optional operation).
|
boolean |
add(K k)
Ensures that this collection contains the specified element (optional
operation).
|
boolean |
addAll(int index,
Collection<? extends K> c)
Adds all of the elements in the specified collection to this list
(optional operation).
|
void |
addElements(int index,
K[] a,
int offset,
int length)
Add (hopefully quickly) elements to this type-specific list.
|
K |
get(int index)
Returns the element at the specified position in this list.
|
void |
getElements(int from,
Object[] a,
int offset,
int length)
Copies (hopefully quickly) elements of this type-specific list into the
given array.
|
ObjectListIterator<K> |
listIterator(int index)
Returns a type-specific list iterator on the list starting at a given
index.
|
K |
remove(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.
|
K |
set(int index,
K k)
Replaces the element at the specified position in this list with the
specified element (optional operation).
|
int |
size()
Returns the number of elements in this collection.
|
ReferenceList<K> |
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, addElements, clear, contains, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, peek, pop, push, size, top, toStringcontainsAll, isEmpty, remove, removeAll, retainAll, toArray, toArraycontainsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayparallelStream, removeIf, streampublic ReferenceSubList(ReferenceList<K> l, int from, int to)
public boolean add(K k)
AbstractReferenceListCollections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.
If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.
This implementation always throws an UnsupportedOperationException.
This implementation delegates to the type-specific version of
List.add(int, Object).
add in interface Collection<K>add in interface List<K>add in class AbstractReferenceList<K>k - element whose presence in this collection is to be ensuredpublic void add(int index,
K k)
AbstractReferenceList
This implementation always throws an
UnsupportedOperationException.
public boolean addAll(int index,
Collection<? extends K> c)
AbstractReferenceListaddAll in interface List<K>addAll in class AbstractReferenceList<K>index - index at which to insert the first element from the
specified collectionc - collection containing elements to be added to this listpublic K get(int index)
java.util.Listpublic K remove(int index)
AbstractReferenceList
This implementation always throws an
UnsupportedOperationException.
public K set(int index, K k)
AbstractReferenceList
This implementation always throws an
UnsupportedOperationException.
public int size()
java.util.Collectionsize in interface Collection<K>size in interface List<K>size in class AbstractCollection<K>public void getElements(int from,
Object[] a,
int offset,
int length)
AbstractReferenceListThis is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
getElements in interface ReferenceList<K>getElements in class AbstractReferenceList<K>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)
AbstractReferenceListThis is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
removeElements in interface ReferenceList<K>removeElements in class AbstractReferenceList<K>from - the start index (inclusive).to - the end index (exclusive).public void addElements(int index,
K[] a,
int offset,
int length)
AbstractReferenceListThis is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.
addElements in interface ReferenceList<K>addElements in class AbstractReferenceList<K>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 ObjectListIterator<K> listIterator(int index)
AbstractReferenceListThis implementation is based on the random-access methods.
listIterator in interface ReferenceList<K>listIterator in interface List<K>listIterator in class AbstractReferenceList<K>index - index of the first element to be returned from the
list iterator (by a call to next)List.listIterator(int)public ReferenceList<K> subList(int from, int to)
ReferenceListfrom, inclusive, to the index to, exclusive.
Note that this specification strengthens the one given in
List.subList(int,int).
subList in interface ReferenceList<K>subList in interface List<K>subList in class AbstractReferenceList<K>from - low endpoint (inclusive) of the subListto - high endpoint (exclusive) of the subListList.subList(int,int)