Class AbstractFloatSet
- java.lang.Object
-
- java.util.AbstractCollection<java.lang.Float>
-
- it.unimi.dsi.fastutil.floats.AbstractFloatCollection
-
- it.unimi.dsi.fastutil.floats.AbstractFloatSet
-
- All Implemented Interfaces:
FloatCollection
,FloatIterable
,FloatSet
,java.lang.Cloneable
,java.lang.Iterable<java.lang.Float>
,java.util.Collection<java.lang.Float>
,java.util.Set<java.lang.Float>
- Direct Known Subclasses:
AbstractFloatSortedSet
,FloatArraySet
,FloatOpenCustomHashSet
,FloatOpenHashBigSet
,FloatOpenHashSet
,FloatSets.Singleton
public abstract class AbstractFloatSet extends AbstractFloatCollection implements java.lang.Cloneable, FloatSet
An abstract class providing basic methods for sets implementing a type-specific interface.Note that the type-specific
Set
interface adds a type-specificremove()
method, as it is no longer harmful for subclasses. Thus, concrete subclasses of this class must implementremove()
(therem()
implementation of this class just delegates toremove()
).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
hashCode()
Returns a hash code for this set.abstract FloatIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
rem(float k)
Deprecated.Please useremove()
instead.boolean
remove(float k)
Removes an element from this set.-
Methods inherited from class it.unimi.dsi.fastutil.floats.AbstractFloatCollection
add, add, addAll, addAll, contains, contains, containsAll, containsAll, remove, removeAll, removeAll, retainAll, retainAll, toArray, toFloatArray, toFloatArray, toString
-
Methods inherited from interface it.unimi.dsi.fastutil.floats.FloatCollection
add, addAll, contains, containsAll, removeAll, removeIf, removeIf, retainAll, toArray, toFloatArray, toFloatArray
-
Methods inherited from interface it.unimi.dsi.fastutil.floats.FloatIterable
forEach, forEach
-
-
-
-
Method Detail
-
iterator
public abstract FloatIterator iterator()
Description copied from interface:FloatCollection
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 interfacejava.util.Collection<java.lang.Float>
- Specified by:
iterator
in interfaceFloatCollection
- Specified by:
iterator
in interfaceFloatIterable
- Specified by:
iterator
in interfaceFloatSet
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Float>
- Specified by:
iterator
in interfacejava.util.Set<java.lang.Float>
- Specified by:
iterator
in classAbstractFloatCollection
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfacejava.util.Collection<java.lang.Float>
- Specified by:
equals
in interfacejava.util.Set<java.lang.Float>
- Overrides:
equals
in classjava.lang.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 interfacejava.util.Collection<java.lang.Float>
- Specified by:
hashCode
in interfacejava.util.Set<java.lang.Float>
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code for this set.
-
remove
public boolean remove(float 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.
-
rem
@Deprecated public boolean rem(float k)
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 interfaceFloatCollection
- Specified by:
rem
in interfaceFloatSet
- Overrides:
rem
in classAbstractFloatCollection
- See Also:
Collection.remove(Object)
-
-