it.unimi.dsi.fastutil.objects
Class ObjectSets.Singleton

java.lang.Object
  extended byit.unimi.dsi.fastutil.objects.AbstractObjectCollection
      extended byit.unimi.dsi.fastutil.objects.AbstractObjectSet
          extended byit.unimi.dsi.fastutil.objects.ObjectSets.Singleton
All Implemented Interfaces:
Cloneable, Collection, ObjectCollection, ObjectSet, Serializable, Set
Direct Known Subclasses:
ObjectSortedSets.Singleton
Enclosing class:
ObjectSets

public static class ObjectSets.Singleton
extends AbstractObjectSet
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(Object k)
           
 boolean addAll(Collection c)
          Adds all elements of the given collection to this collection.
 boolean addAll(List l)
           
 Object clone()
           
 boolean contains(Object k)
           
 ObjectIterator objectIterator()
          Returns a type-specific iterator on the 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()
           
 Object[] toArray()
           
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectSet
equals, hashCode, iterator, rem, remove
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectCollection
clear, containsAll, isEmpty, iterator, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, iterator, toArray
 

Field Detail

serialVersionUID

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

add

public boolean add(Object k)
Specified by:
add in interface Set
Overrides:
add in class AbstractObjectCollection

contains

public boolean contains(Object k)
Specified by:
contains in interface Set

addAll

public boolean addAll(List l)

addAll

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

Specified by:
addAll in interface Set
Overrides:
addAll in class AbstractObjectCollection
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 Set
Overrides:
removeAll in class AbstractObjectCollection
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 Set
Overrides:
retainAll in class AbstractObjectCollection
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

toArray

public Object[] toArray()
Specified by:
toArray in interface Set
Overrides:
toArray in class AbstractObjectCollection

objectIterator

public ObjectIterator objectIterator()
Description copied from interface: ObjectCollection
Returns a type-specific iterator on the collection.

The iterator returned by the Collection.iterator() method and by this method are identical; however, using this method you can save a type casting.

Specified by:
objectIterator in interface ObjectCollection
See Also:
Collection.iterator()

size

public int size()
Specified by:
size in interface Set

clone

public Object clone()