Interface LongSet

All Superinterfaces:
Collection<Long>, Iterable<Long>, LongCollection, LongIterable, Set<Long>
All Known Subinterfaces:
LongSortedSet
All Known Implementing Classes:
AbstractLongSet, AbstractLongSortedSet, LongArraySet, LongAVLTreeSet, LongLinkedOpenCustomHashSet, LongLinkedOpenHashSet, LongOpenCustomHashSet, LongOpenHashBigSet, LongOpenHashSet, LongRBTreeSet, LongSets.EmptySet, LongSets.Singleton, LongSets.SynchronizedSet, LongSets.UnmodifiableSet, LongSortedSets.EmptySet, LongSortedSets.Singleton, LongSortedSets.SynchronizedSortedSet, LongSortedSets.UnmodifiableSortedSet

public interface LongSet
extends LongCollection, Set<Long>
A type-specific Set; provides some additional methods that use polymorphism to avoid (un)boxing.

Additionally, this interface strengthens (again) iterator().

See Also:
Set
  • Method Details

    • iterator

      LongIterator iterator()
      Returns a type-specific iterator on the elements of this set.

      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 extends Set.

      Specified by:
      iterator in interface Collection<Long>
      Specified by:
      iterator in interface Iterable<Long>
      Specified by:
      iterator in interface LongCollection
      Specified by:
      iterator in interface LongIterable
      Specified by:
      iterator in interface Set<Long>
      Returns:
      a type-specific iterator on the elements of this set.
      See Also:
      Iterable.iterator()
    • remove

      boolean remove​(long 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 the List interface.

      See Also:
      Collection.remove(Object)
    • remove

      @Deprecated default boolean remove​(Object o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      remove in interface Collection<Long>
      Specified by:
      remove in interface LongCollection
      Specified by:
      remove in interface Set<Long>
    • add

      @Deprecated default boolean add​(Long o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      add in interface Collection<Long>
      Specified by:
      add in interface LongCollection
      Specified by:
      add in interface Set<Long>
    • contains

      @Deprecated default boolean contains​(Object o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      contains in interface Collection<Long>
      Specified by:
      contains in interface LongCollection
      Specified by:
      contains in interface Set<Long>
    • rem

      @Deprecated default boolean rem​(long k)
      Deprecated.
      Please use remove() instead.
      Removes an element from this set.

      This method is inherited from the type-specific collection this type-specific set is based on, but it should not used as this interface reinstates remove() as removal method.

      Specified by:
      rem in interface LongCollection
      See Also:
      Collection.remove(Object)
    • of

      @SafeVarargs static LongSet of​(long... a)
      Creates a new set using a list of elements.
      Parameters:
      a - a list of elements that will be used to initialize the new set.