Package it.unimi.dsi.fastutil.shorts
Class AbstractShortSet
- java.lang.Object
-
- java.util.AbstractCollection<java.lang.Short>
-
- it.unimi.dsi.fastutil.shorts.AbstractShortCollection
-
- it.unimi.dsi.fastutil.shorts.AbstractShortSet
-
- All Implemented Interfaces:
ShortCollection
,ShortIterable
,ShortSet
,java.lang.Cloneable
,java.lang.Iterable<java.lang.Short>
,java.util.Collection<java.lang.Short>
,java.util.Set<java.lang.Short>
- Direct Known Subclasses:
AbstractShortSortedSet
,ShortArraySet
,ShortOpenCustomHashSet
,ShortOpenHashSet
,ShortSets.Singleton
public abstract class AbstractShortSet extends AbstractShortCollection implements java.lang.Cloneable, ShortSet
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 ShortIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
rem(short k)
Deprecated.Please useremove()
instead.boolean
remove(short k)
Removes an element from this set.-
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
add, add, addAll, addAll, contains, contains, containsAll, containsAll, remove, removeAll, removeAll, retainAll, retainAll, toArray, toShortArray, toShortArray, toString
-
Methods inherited from interface java.util.Set
addAll, clear, containsAll, isEmpty, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortCollection
add, addAll, contains, containsAll, intIterator, intParallelStream, intSpliterator, intStream, parallelStream, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toArray, toShortArray, toShortArray
-
Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortIterable
forEach, forEach, forEach
-
Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortSet
add, contains, remove, spliterator
-
-
-
-
Method Detail
-
iterator
public abstract ShortIterator iterator()
Description copied from interface:ShortCollection
Returns a type-specific iterator on the elements of this collection.- Specified by:
iterator
in interfacejava.util.Collection<java.lang.Short>
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Short>
- Specified by:
iterator
in interfacejava.util.Set<java.lang.Short>
- Specified by:
iterator
in interfaceShortCollection
- Specified by:
iterator
in interfaceShortIterable
- Specified by:
iterator
in interfaceShortSet
- Specified by:
iterator
in classAbstractShortCollection
- 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.Short>
- Specified by:
equals
in interfacejava.util.Set<java.lang.Short>
- 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.Short>
- Specified by:
hashCode
in interfacejava.util.Set<java.lang.Short>
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code for this set.
-
remove
public boolean remove(short k)
Removes an element from this set. Delegates to the type-specificrem()
method implemented by type-specific abstractCollection
superclass.
-
rem
@Deprecated public boolean rem(short 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 interfaceShortCollection
- Specified by:
rem
in interfaceShortSet
- Overrides:
rem
in classAbstractShortCollection
- See Also:
Collection.remove(Object)
-
-