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-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 Details

    • 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 interface java.util.Collection<java.lang.Short>
      Specified by:
      iterator in interface java.lang.Iterable<java.lang.Short>
      Specified by:
      iterator in interface java.util.Set<java.lang.Short>
      Specified by:
      iterator in interface ShortCollection
      Specified by:
      iterator in interface ShortIterable
      Specified by:
      iterator in interface ShortSet
      Specified by:
      iterator in class AbstractShortCollection
      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 interface java.util.Collection<java.lang.Short>
      Specified by:
      equals in interface java.util.Set<java.lang.Short>
      Overrides:
      equals in class java.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 interface java.util.Collection<java.lang.Short>
      Specified by:
      hashCode in interface java.util.Set<java.lang.Short>
      Overrides:
      hashCode in class java.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-specific rem() method implemented by type-specific abstract Collection superclass.
      Specified by:
      remove in interface ShortSet
      See Also:
      Collection.remove(Object)
    • rem

      @Deprecated public boolean rem​(short k)
      Deprecated.
      Please use remove() 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 the List interface forces us to use a distinguished name. For simplicity, the set interfaces reinstates remove(). Delegates to the type-specific remove() method specified in the type-specific Set interface.

      Specified by:
      rem in interface ShortCollection
      Specified by:
      rem in interface ShortSet
      Overrides:
      rem in class AbstractShortCollection
      See Also:
      Collection.remove(Object)