public abstract static class ObjectCollections.EmptyCollection<K> extends AbstractObjectCollection<K>
This class may be useful to implement your own in case you subclass a type-specific collection.
Modifier and Type | Method and Description |
---|---|
boolean |
add(K k) |
void |
clear() |
boolean |
contains(Object k) |
boolean |
equals(Object o) |
int |
hashCode() |
ObjectBidirectionalIterator<K> |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
boolean |
remove(Object k) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a)
Returns an containing the items of this collection; the runtime type of the returned array is that of the specified array.
|
addAll, containsAll, isEmpty, objectIterator, removeAll, retainAll, toString
parallelStream, removeIf, spliterator, stream
public boolean add(K k)
add
in interface Collection<K>
add
in class AbstractObjectCollection<K>
public boolean contains(Object k)
contains
in interface Collection<K>
contains
in class AbstractCollection<K>
public Object[] toArray()
toArray
in interface Collection<K>
toArray
in class AbstractObjectCollection<K>
public boolean remove(Object k)
remove
in interface Collection<K>
remove
in class AbstractCollection<K>
public <T> T[] toArray(T[] a)
ObjectCollection
Warning: Note that, contrarily to Collection.toArray(Object[])
, this methods just writes all elements of this collection: no special value will be added after the
last one.
toArray
in interface ObjectCollection<K>
toArray
in interface Collection<K>
toArray
in class AbstractObjectCollection<K>
a
- if this array is big enough, it will be used to store this collection.Collection.toArray(Object[])
public ObjectBidirectionalIterator<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 Iterable<K>
iterator
in interface Collection<K>
iterator
in class AbstractObjectCollection<K>
public int size()
size
in interface Collection<K>
size
in class AbstractCollection<K>
public void clear()
clear
in interface Collection<K>
clear
in class AbstractCollection<K>
public int hashCode()
hashCode
in interface Collection<K>
hashCode
in class Object