it.unimi.dsi.fastutil.objects
Class AbstractReferenceSet<K>

java.lang.Object
  extended by java.util.AbstractCollection<K>
      extended by it.unimi.dsi.fastutil.objects.AbstractReferenceCollection<K>
          extended by it.unimi.dsi.fastutil.objects.AbstractReferenceSet<K>
All Implemented Interfaces:
ObjectIterable<K>, ReferenceCollection<K>, ReferenceSet<K>, Cloneable, Iterable<K>, Collection<K>, Set<K>
Direct Known Subclasses:
AbstractReferenceSortedSet, ReferenceArraySet, ReferenceOpenHashBigSet, ReferenceOpenHashSet, ReferenceSets.Singleton

public abstract class AbstractReferenceSet<K>
extends AbstractReferenceCollection<K>
implements Cloneable, ReferenceSet<K>

An abstract class providing basic methods for sets implementing a type-specific interface.


Constructor Summary
protected AbstractReferenceSet()
           
 
Method Summary
 boolean equals(Object o)
           
 int hashCode()
          Returns a hash code for this set.
abstract  ObjectIterator<K> iterator()
          Returns a type-specific iterator on the elements of this collection.
 boolean remove(Object k)
          Removes an element from this set.
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection
add, addAll, containsAll, isEmpty, objectIterator, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.util.AbstractCollection
clear, contains, size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.ReferenceCollection
objectIterator, toArray
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, isEmpty, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

AbstractReferenceSet

protected AbstractReferenceSet()
Method Detail

iterator

public abstract ObjectIterator<K> iterator()
Description copied from interface: ReferenceCollection
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 ObjectIterable<K>
Specified by:
iterator in interface ReferenceCollection<K>
Specified by:
iterator in interface ReferenceSet<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 AbstractReferenceCollection<K>
Returns:
a type-specific iterator on the elements of this collection.

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection<K>
Specified by:
equals in interface Set<K>
Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code for this set. The hash code of a set is computed by summing the hash codes of its elements.

Specified by:
hashCode in interface Collection<K>
Specified by:
hashCode in interface Set<K>
Overrides:
hashCode in class Object
Returns:
a hash code for this set.

remove

public boolean remove(Object k)
Description copied from interface: ReferenceSet
Removes an element from this set.

Note that the corresponding method of the type-specific collection is rem(). This unfortunate situation is caused by the clash with the similarly named index-based method in the List interface.

Specified by:
remove in interface ReferenceSet<K>
Specified by:
remove in interface Collection<K>
Specified by:
remove in interface Set<K>
Overrides:
remove in class AbstractCollection<K>
See Also:
Collection.remove(Object)


Copyright © 2011. All Rights Reserved.