Package it.unimi.dsi.fastutil.longs
Class AbstractLongSet
java.lang.Object
java.util.AbstractCollection<java.lang.Long>
it.unimi.dsi.fastutil.longs.AbstractLongCollection
it.unimi.dsi.fastutil.longs.AbstractLongSet
- All Implemented Interfaces:
LongCollection
,LongIterable
,LongSet
,java.lang.Cloneable
,java.lang.Iterable<java.lang.Long>
,java.util.Collection<java.lang.Long>
,java.util.Set<java.lang.Long>
- Direct Known Subclasses:
AbstractLongSortedSet
,LongArraySet
,LongOpenCustomHashSet
,LongOpenHashBigSet
,LongOpenHashSet
,LongSets.Singleton
public abstract class AbstractLongSet extends AbstractLongCollection implements java.lang.Cloneable, LongSet
An abstract class providing basic methods for sets implementing a
type-specific interface.
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(java.lang.Object o)
int
hashCode()
Returns a hash code for this set.abstract LongIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
rem(long k)
Deprecated.boolean
remove(long k)
Removes an element from this set.Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection
add, add, addAll, addAll, contains, contains, containsAll, containsAll, forEach, remove, removeAll, removeAll, removeIf, retainAll, retainAll, toArray, toLongArray, toLongArray, toString
Methods inherited from class java.util.AbstractCollection
clear, isEmpty, size, toArray, toArray
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
toArray
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection
add, addAll, contains, containsAll, longIterator, longParallelStream, longSpliterator, longStream, parallelStream, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toArray, toLongArray, toLongArray
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongIterable
forEach, forEach, forEach
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongSet
add, contains, remove, spliterator
Methods inherited from interface java.util.Set
addAll, clear, containsAll, isEmpty, removeAll, retainAll, size, toArray, toArray
-
Method Details
-
iterator
Description copied from interface:LongCollection
Returns a type-specific iterator on the elements of this collection.- Specified by:
iterator
in interfacejava.util.Collection<java.lang.Long>
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Long>
- Specified by:
iterator
in interfaceLongCollection
- Specified by:
iterator
in interfaceLongIterable
- Specified by:
iterator
in interfaceLongSet
- Specified by:
iterator
in interfacejava.util.Set<java.lang.Long>
- Specified by:
iterator
in classAbstractLongCollection
- 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.Long>
- Specified by:
equals
in interfacejava.util.Set<java.lang.Long>
- 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.Long>
- Specified by:
hashCode
in interfacejava.util.Set<java.lang.Long>
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code for this set.
-
remove
public boolean remove(long k)Removes an element from this set. Delegates to the type-specificrem()
method implemented by type-specific abstractCollection
superclass. -
rem
@Deprecated public boolean rem(long 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()
. Delegates to the type-specificremove()
method specified in the type-specificSet
interface.- Specified by:
rem
in interfaceLongCollection
- Specified by:
rem
in interfaceLongSet
- Overrides:
rem
in classAbstractLongCollection
- See Also:
Collection.remove(Object)
-
remove()
instead.