it.unimi.dsi.fastutil.objects
Class ObjectSets.Singleton<K>

java.lang.Object
  extended by it.unimi.dsi.fastutil.objects.AbstractObjectCollection<K>
      extended by it.unimi.dsi.fastutil.objects.AbstractObjectSet<K>
          extended by it.unimi.dsi.fastutil.objects.ObjectSets.Singleton<K>
All Implemented Interfaces:
ObjectCollection<K>, ObjectIterable<K>, ObjectSet<K>, Serializable, Cloneable, Iterable<K>, Collection<K>, Set<K>
Direct Known Subclasses:
ObjectSortedSets.Singleton
Enclosing class:
ObjectSets

public static class ObjectSets.Singleton<K>
extends AbstractObjectSet<K>
implements Serializable, Cloneable

An immutable class representing a type-specific singleton set.

This class may be useful to implement your own in case you subclass a type-specific set.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean add(K k)
           
 boolean addAll(Collection<? extends K> c)
          Adds all elements of the given collection to this collection.
 Object clone()
           
 boolean contains(Object k)
           
 ObjectListIterator<K> iterator()
          Returns a type-specific iterator on the elements of this collection.
 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()
           
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectSet
equals, hashCode, remove
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
clear, containsAll, isEmpty, objectIterator, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.ObjectCollection
objectIterator, toArray
 
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, toArray, toArray
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Method Detail

add

public boolean add(K k)
Specified by:
add in interface Collection<K>
Specified by:
add in interface Set<K>
Overrides:
add in class AbstractObjectCollection<K>

contains

public boolean contains(Object k)
Specified by:
contains in interface Collection<K>
Specified by:
contains in interface Set<K>

addAll

public boolean addAll(Collection<? extends K> c)
Description copied from class: AbstractObjectCollection
Adds all elements of the given collection to this collection.

Specified by:
addAll in interface Collection<K>
Specified by:
addAll in interface Set<K>
Overrides:
addAll in class AbstractObjectCollection<K>
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

removeAll

public boolean removeAll(Collection<?> c)
Description copied from class: AbstractObjectCollection
Remove from this collection all elements in the given collection. If the collection is an instance of this class, it uses faster iterators.

Specified by:
removeAll in interface Collection<K>
Specified by:
removeAll in interface Set<K>
Overrides:
removeAll in class AbstractObjectCollection<K>
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

retainAll

public boolean retainAll(Collection<?> c)
Description copied from class: AbstractObjectCollection
Retains in this collection only elements from the given collection.

Specified by:
retainAll in interface Collection<K>
Specified by:
retainAll in interface Set<K>
Overrides:
retainAll in class AbstractObjectCollection<K>
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

iterator

public ObjectListIterator<K> iterator()
Description copied from interface: ObjectCollection
Returns a type-specific iterator on the elements of this collection.

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.

Specified by:
iterator in interface ObjectCollection<K>
Specified by:
iterator in interface ObjectIterable<K>
Specified by:
iterator in interface ObjectSet<K>
Specified by:
iterator in interface Iterable<K>
Specified by:
iterator in interface Collection<K>
Specified by:
iterator in interface Set<K>
Specified by:
iterator in class AbstractObjectSet<K>
Returns:
a type-specific iterator on the elements of this collection.

size

public int size()
Specified by:
size in interface Collection<K>
Specified by:
size in interface Set<K>

clone

public Object clone()
Overrides:
clone in class Object