Class AbstractDoubleSet
- All Implemented Interfaces:
DoubleCollection
,DoubleIterable
,DoubleSet
,Cloneable
,Iterable<Double>
,Collection<Double>
,Set<Double>
- Direct Known Subclasses:
AbstractDoubleSortedSet
,DoubleArraySet
,DoubleOpenCustomHashSet
,DoubleOpenHashBigSet
,DoubleOpenHashSet
,DoubleSets.Singleton
public abstract class AbstractDoubleSet extends AbstractDoubleCollection implements Cloneable, DoubleSet
Note that the type-specific Set
interface adds a type-specific
remove()
method, as it is no longer harmful for subclasses. Thus,
concrete subclasses of this class must implement remove()
(the
rem()
implementation of this class just delegates to
remove()
).
-
Method Summary
Modifier and Type Method Description boolean
equals(Object o)
int
hashCode()
Returns a hash code for this set.abstract DoubleIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
rem(double k)
Deprecated.Please useremove()
instead.boolean
remove(double k)
Removes an element from this set.Methods inherited from class it.unimi.dsi.fastutil.doubles.AbstractDoubleCollection
add, add, addAll, contains, contains, containsAll, remove, removeAll, retainAll, toArray, toDoubleArray, toDoubleArray, toString
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, removeAll, retainAll, size, toArray, toArray
Methods inherited from interface it.unimi.dsi.fastutil.doubles.DoubleCollection
add, addAll, contains, containsAll, removeAll, removeIf, removeIf, retainAll, toArray, toDoubleArray, toDoubleArray
-
Method Details
-
iterator
Description copied from interface:DoubleCollection
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 extendsCollection
.- Specified by:
iterator
in interfaceCollection<Double>
- Specified by:
iterator
in interfaceDoubleCollection
- Specified by:
iterator
in interfaceDoubleIterable
- Specified by:
iterator
in interfaceDoubleSet
- Specified by:
iterator
in interfaceIterable<Double>
- Specified by:
iterator
in interfaceSet<Double>
- Specified by:
iterator
in classAbstractDoubleCollection
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
equals
-
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. -
remove
public boolean remove(double k)Removes an element from this set.Note that the corresponding method of a type-specific collection is
rem()
. This unfortunate situation is caused by the clash with the similarly named index-based method in theList
interface. Delegates to the type-specificrem()
method implemented by type-specific abstractCollection
superclass.- Specified by:
remove
in interfaceDoubleSet
- See Also:
Collection.remove(Object)
-
rem
Deprecated.Please useremove()
instead.Removes a single instance of the specified element from this collection, if it is present (optional operation).Note that this method should be called
remove()
, but the clash with the similarly named index-based method in theList
interface forces us to use a distinguished name. For simplicity, the set interfaces reinstatesremove()
.This implementation iterates over the elements in the collection, looking for the specified element and tries to remove it. Delegates to the type-specific
remove()
method specified in the type-specificSet
interface.- Specified by:
rem
in interfaceDoubleCollection
- Specified by:
rem
in interfaceDoubleSet
- Overrides:
rem
in classAbstractDoubleCollection
- See Also:
Collection.remove(Object)
-