public static class ObjectLists.Singleton<K> extends AbstractObjectList<K> implements Serializable, Cloneable
This class may be useful to implement your own in case you subclass a type-specific list.
AbstractObjectList.ObjectSubList<K>
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(Collection<? extends K> c)
Delegates to a more generic method.
|
boolean |
addAll(int i,
Collection<? extends K> c) |
void |
clear() |
Object |
clone() |
boolean |
contains(Object k) |
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) |
boolean |
remove(Object k) |
boolean |
removeAll(Collection<?> c)
Remove from this collection all elements in the given collection.
|
boolean |
retainAll(Collection<?> c)
Retains in this collection only elements from the given collection.
|
int |
size() |
void |
size(int size)
Sets the size of this list.
|
ObjectList<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. |
Object[] |
toArray() |
add, add, addElements, addElements, compareTo, equals, getElements, hashCode, indexOf, lastIndexOf, objectListIterator, objectListIterator, objectSubList, peek, pop, push, removeElements, set, top, toString
containsAll, isEmpty, objectIterator, toArray
containsAll, isEmpty, toArray
objectIterator, toArray
public K remove(int i)
public boolean contains(Object k)
contains
in interface Collection<K>
contains
in interface List<K>
contains
in class AbstractObjectList<K>
public boolean addAll(Collection<? extends K> c)
AbstractObjectList
addAll
in interface Collection<K>
addAll
in interface List<K>
addAll
in class AbstractObjectList<K>
c
- a collection.true
if this collection changed as a result of the call.public boolean addAll(int i, Collection<? extends K> c)
public boolean removeAll(Collection<?> c)
AbstractObjectCollection
removeAll
in interface Collection<K>
removeAll
in interface List<K>
removeAll
in class AbstractObjectCollection<K>
c
- a collection.true
if this collection changed as a result of the call.public boolean retainAll(Collection<?> c)
AbstractObjectCollection
retainAll
in interface Collection<K>
retainAll
in interface List<K>
retainAll
in class AbstractObjectCollection<K>
c
- a collection.true
if this collection changed as a result of the call.public Object[] toArray()
toArray
in interface Collection<K>
toArray
in interface List<K>
toArray
in class AbstractObjectCollection<K>
public ObjectListIterator<K> listIterator()
ObjectList
listIterator
in interface ObjectList<K>
listIterator
in interface List<K>
listIterator
in class AbstractObjectList<K>
List.listIterator()
public ObjectListIterator<K> iterator()
ObjectCollection
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
.
iterator
in interface ObjectCollection<K>
iterator
in interface ObjectIterable<K>
iterator
in interface ObjectList<K>
iterator
in interface Iterable<K>
iterator
in interface Collection<K>
iterator
in interface List<K>
iterator
in class AbstractObjectList<K>
public ObjectListIterator<K> listIterator(int i)
ObjectList
listIterator
in interface ObjectList<K>
listIterator
in interface List<K>
listIterator
in class AbstractObjectList<K>
List.listIterator(int)
public ObjectList<K> subList(int from, int to)
ObjectList
from
, inclusive, to the index to
, exclusive.
Note that this specification strengthens the one given in List.subList(int,int)
.
subList
in interface ObjectList<K>
subList
in interface List<K>
subList
in class AbstractObjectList<K>
List.subList(int,int)
public int size()
size
in interface Collection<K>
size
in interface List<K>
size
in class AbstractCollection<K>
public void size(int size)
ObjectList
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 ObjectList<K>
size
in class AbstractObjectList<K>
size
- the new size.public void clear()
clear
in interface Collection<K>
clear
in interface List<K>
clear
in class AbstractCollection<K>
public boolean remove(Object k)
remove
in interface Collection<K>
remove
in interface List<K>
remove
in class AbstractCollection<K>