public static class ObjectSets.Singleton<K> extends AbstractObjectSet<K> implements java.io.Serializable, java.lang.Cloneable
This class may be useful to implement your own in case you subclass a type-specific set.
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(K k) |
boolean |
addAll(java.util.Collection<? extends K> c)
Adds all elements of the given collection to this collection.
|
java.lang.Object |
clone() |
boolean |
contains(java.lang.Object k) |
ObjectListIterator<K> |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
boolean |
removeAll(java.util.Collection<?> c)
Remove from this collection all elements in the given collection.
|
boolean |
retainAll(java.util.Collection<?> c)
Retains in this collection only elements from the given collection.
|
int |
size() |
equals, hashCodecontainsAll, isEmpty, objectIterator, toArray, toArray, toStringobjectIterator, toArraypublic boolean add(K k)
add in interface java.util.Collection<K>add in interface java.util.Set<K>add in class AbstractObjectCollection<K>public boolean contains(java.lang.Object k)
public boolean addAll(java.util.Collection<? extends K> c)
AbstractObjectCollectionaddAll in interface java.util.Collection<K>addAll in interface java.util.Set<K>addAll in class AbstractObjectCollection<K>c - a collection.true if this collection changed as a result of the call.public boolean removeAll(java.util.Collection<?> c)
AbstractObjectCollectionremoveAll in interface java.util.Collection<K>removeAll in interface java.util.Set<K>removeAll in class AbstractObjectCollection<K>c - a collection.true if this collection changed as a result of the call.public boolean retainAll(java.util.Collection<?> c)
AbstractObjectCollectionretainAll in interface java.util.Collection<K>retainAll in interface java.util.Set<K>retainAll in class AbstractObjectCollection<K>c - a collection.true if this collection changed as a result of the call.public ObjectListIterator<K> iterator()
ObjectCollectionNote 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 ObjectSet<K>iterator in interface java.lang.Iterable<K>iterator in interface java.util.Collection<K>iterator in interface java.util.Set<K>iterator in class AbstractObjectSet<K>public int size()
public java.lang.Object clone()
clone in class java.lang.Object