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

java.lang.Object
  extended byit.unimi.dsi.fastutil.objects.AbstractReferenceCollection
      extended byit.unimi.dsi.fastutil.objects.AbstractReferenceSet
          extended byit.unimi.dsi.fastutil.objects.ReferenceSets.Singleton
All Implemented Interfaces:
Cloneable, Collection, ReferenceCollection, ReferenceSet, Serializable, Set
Direct Known Subclasses:
ReferenceSortedSets.Singleton
Enclosing class:
ReferenceSets

public static class ReferenceSets.Singleton
extends AbstractReferenceSet
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.AbstractReferenceSet
equals, hashCode, iterator, rem, remove
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection
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 AbstractReferenceCollection

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: AbstractReferenceCollection
Adds all elements of the given collection to this collection.

Specified by:
addAll in interface Set
Overrides:
addAll in class AbstractReferenceCollection
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: AbstractReferenceCollection
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 AbstractReferenceCollection
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: AbstractReferenceCollection
Retains in this collection only elements from the given collection.

Specified by:
retainAll in interface Set
Overrides:
retainAll in class AbstractReferenceCollection
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 AbstractReferenceCollection

objectIterator

public ObjectIterator objectIterator()
Description copied from interface: ReferenceCollection
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 ReferenceCollection
See Also:
Collection.iterator()

size

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

clone

public Object clone()