Class IntSets.EmptySet

All Implemented Interfaces:
IntCollection, IntIterable, IntSet, Serializable, Cloneable, Iterable<Integer>, Collection<Integer>, Set<Integer>
Direct Known Subclasses:
IntSortedSets.EmptySet
Enclosing class:
IntSets

public static class IntSets.EmptySet
extends IntCollections.EmptyCollection
implements IntSet, Serializable, Cloneable
An immutable class representing the empty set and implementing a type-specific set interface.

This class may be useful to implement your own in case you subclass a type-specific set.

See Also:
Serialized Form
  • Method Details

    • remove

      public boolean remove​(int ok)
      Description copied from interface: IntSet
      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.

      Specified by:
      remove in interface IntSet
      See Also:
      Collection.remove(Object)
    • clone

      public Object clone()
    • equals

      public boolean equals​(Object o)
      Specified by:
      equals in interface Collection<Integer>
      Specified by:
      equals in interface Set<Integer>
      Overrides:
      equals in class IntCollections.EmptyCollection
    • rem

      @Deprecated public boolean rem​(int k)
      Deprecated.
      Description copied from class: AbstractIntCollection
      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().

      This implementation iterates over the elements in the collection, looking for the specified element and tries to remove it.

      Specified by:
      rem in interface IntCollection
      Specified by:
      rem in interface IntSet
      Overrides:
      rem in class AbstractIntCollection
      See Also:
      Collection.remove(Object)