public static class ReferenceLists.Singleton<K> extends AbstractReferenceList<K> implements java.util.RandomAccess, java.io.Serializable, java.lang.Cloneable
This class may be useful to implement your own in case you subclass a type-specific list.
AbstractReferenceList.ReferenceSubList<K>| Modifier and Type | Method and Description |
|---|---|
boolean |
addAll(java.util.Collection<? extends K> c)
This implementation delegates to the type-specific version of
List.addAll(int, Collection). |
boolean |
addAll(int i,
java.util.Collection<? extends K> c)
Adds all of the elements in the specified collection to this list (optional
operation).
|
void |
clear()
This implementation delegates to
AbstractReferenceList.removeElements(int, int). |
java.lang.Object |
clone() |
boolean |
contains(java.lang.Object k)
Returns true if this list contains the specified element.
|
K |
get(int i) |
ObjectListIterator<K> |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
ObjectListIterator<K> |
listIterator()
Returns a type-specific list iterator on the list.
|
ObjectListIterator<K> |
listIterator(int i)
Returns a type-specific list iterator on the list starting at a given index.
|
K |
remove(int i)
This implementation always throws an
UnsupportedOperationException. |
boolean |
remove(java.lang.Object k) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
void |
size(int size)
Sets the size of this list.
|
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. |
java.lang.Object[] |
toArray() |
add, add, addElements, addElements, equals, getElements, hashCode, indexOf, lastIndexOf, peek, pop, push, removeElements, set, top, toStringpublic boolean remove(java.lang.Object k)
public K remove(int i)
AbstractReferenceList
This implementation always throws an UnsupportedOperationException.
remove in interface java.util.List<K>remove in class AbstractReferenceList<K>public boolean contains(java.lang.Object k)
AbstractReferenceList
This implementation delegates to indexOf().
contains in interface java.util.Collection<K>contains in interface java.util.List<K>contains in class AbstractReferenceList<K>List.contains(Object)public java.lang.Object[] toArray()
public ObjectListIterator<K> listIterator()
AbstractReferenceList
This implementation delegates to listIterator(0).
listIterator in interface ReferenceList<K>listIterator in interface java.util.List<K>listIterator in class AbstractReferenceList<K>List.listIterator()public ObjectListIterator<K> iterator()
AbstractReferenceList
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.
This implementation delegates to AbstractReferenceList.listIterator().
iterator in interface ObjectIterable<K>iterator in interface ReferenceCollection<K>iterator in interface ReferenceList<K>iterator in interface java.lang.Iterable<K>iterator in interface java.util.Collection<K>iterator in interface java.util.List<K>iterator in class AbstractReferenceList<K>Iterable.iterator()public ObjectListIterator<K> listIterator(int i)
AbstractReferenceListThis implementation is based on the random-access methods.
listIterator in interface ReferenceList<K>listIterator in interface java.util.List<K>listIterator in class AbstractReferenceList<K>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 java.util.List<K>subList in class AbstractReferenceList<K>List.subList(int,int)public boolean addAll(int i,
java.util.Collection<? extends K> c)
AbstractReferenceListaddAll in interface java.util.List<K>addAll in class AbstractReferenceList<K>public boolean addAll(java.util.Collection<? extends K> c)
AbstractReferenceList
This implementation delegates to the type-specific version of
List.addAll(int, Collection).
addAll in interface java.util.Collection<K>addAll in interface java.util.List<K>addAll in class AbstractReferenceList<K>public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public int size()
public void size(int size)
ReferenceList
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 ReferenceList<K>size in class AbstractReferenceList<K>size - the new size.public void clear()
AbstractReferenceList
This implementation delegates to AbstractReferenceList.removeElements(int, int).
clear in interface java.util.Collection<K>clear in interface java.util.List<K>clear in class AbstractReferenceList<K>public java.lang.Object clone()
clone in class java.lang.Object