Class EnumLongMap.Keys

All Implemented Interfaces:
EnhancedCollection<Enum<?>>, Iterable<Enum<?>>, Collection<Enum<?>>, Set<Enum<?>>
Direct Known Subclasses:
EnumLongOrderedMap.OrderedMapKeys
Enclosing class:
EnumLongMap

public static class EnumLongMap.Keys extends EnumSet
  • Field Details

  • Constructor Details

  • Method Details

    • add

      public boolean add(Enum<?> item)
      Description copied from class: EnumSet
      Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element e to this set if the set contains no element e2 such that Objects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.

      The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throw an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the elements that they may contain.

      Specified by:
      add in interface Collection<Enum<?>>
      Specified by:
      add in interface Set<Enum<?>>
      Overrides:
      add in class EnumSet
      Parameters:
      item - element to be added to this set
      Returns:
      true if this set did not already contain the specified element
    • addAll

      public boolean addAll(Collection<? extends Enum<?>> c)
      Description copied from class: EnumSet
      Adds all the elements in the specified collection to this collection.
      Specified by:
      addAll in interface Collection<Enum<?>>
      Specified by:
      addAll in interface Set<Enum<?>>
      Overrides:
      addAll in class EnumSet
      Parameters:
      c - usually another EnumSet, but not required to be
    • addAll

      public boolean addAll(Enum<?>[] c)
      Description copied from class: EnumSet
      Adds all Enum items in the given array to this set. Returns true if this set was modified at all in the process (that is, if any items in c were not already present in this set).
      Specified by:
      addAll in interface EnhancedCollection<Enum<?>>
      Overrides:
      addAll in class EnumSet
      See Also:
    • contains

      public boolean contains(Object o)
      Description copied from class: EnumSet
      Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(item, e).
      Specified by:
      contains in interface Collection<Enum<?>>
      Specified by:
      contains in interface Set<Enum<?>>
      Overrides:
      contains in class EnumSet
      Parameters:
      o - element whose presence in this set is to be tested
      Returns:
      true if this set contains the specified element
    • remove

      public boolean remove(Object o)
      Description copied from class: EnumSet
      Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that Objects.equals(item, e), if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)
      Specified by:
      remove in interface Collection<Enum<?>>
      Specified by:
      remove in interface Set<Enum<?>>
      Overrides:
      remove in class EnumSet
      Parameters:
      o - object to be removed from this set, if present
      Returns:
      true if this set contained the specified element
    • removeAll

      public boolean removeAll(Collection<?> c)
      Description copied from class: EnumSet
      Removes from this EnumSet every element in the given Collection.
      Specified by:
      removeAll in interface Collection<Enum<?>>
      Specified by:
      removeAll in interface Set<Enum<?>>
      Overrides:
      removeAll in class EnumSet
      Parameters:
      c - usually another EnumSet, but not required to be
      Returns:
      true if this set changed as a result of the call
    • iterator

      public Iterator<Enum<?>> iterator()
      Returns an iterator over the elements contained in this collection.
      Specified by:
      iterator in interface Collection<Enum<?>>
      Specified by:
      iterator in interface Iterable<Enum<?>>
      Specified by:
      iterator in interface Set<Enum<?>>
      Overrides:
      iterator in class EnumSet
      Returns:
      an iterator over the elements contained in this collection
    • clear

      public void clear()
      Removes all the elements from this set. The set will be empty after this call returns. This does not change the universe of possible Enum items this can hold.
      Specified by:
      clear in interface Collection<Enum<?>>
      Specified by:
      clear in interface Set<Enum<?>>
      Overrides:
      clear in class EnumSet
    • size

      public int size()
      Description copied from class: EnumSet
      Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
      Specified by:
      size in interface Collection<Enum<?>>
      Specified by:
      size in interface Set<Enum<?>>
      Overrides:
      size in class EnumSet
      Returns:
      the number of elements in this set (its cardinality)
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in interface Collection<Enum<?>>
      Specified by:
      equals in interface Set<Enum<?>>
      Overrides:
      equals in class AbstractSet<Enum<?>>
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<Enum<?>>
      Specified by:
      hashCode in interface Set<Enum<?>>
      Overrides:
      hashCode in class AbstractSet<Enum<?>>
    • resetIterator

      public void resetIterator()
      The iterator is reused by this data structure, and you can reset it back to the start of the iteration order using this.
    • toList

      public ObjectList<Enum<?>> toList()
      Returns a new ObjectList containing the remaining items. Does not change the position of this iterator.
      Returns:
      a new ObjectList containing the remaining items
    • toEnumSet

      public EnumSet toEnumSet()
      Returns a new EnumSet containing the remaining items. Does not change the position of this iterator. The EnumSet this returns will share a key universe with the map linked to this key set.
      Returns:
      a new EnumSet containing the remaining items, sharing a universe with this key set
    • appendInto

      public Collection<Enum<?>> appendInto(Collection<Enum<?>> coll)
      Append the remaining items that this can iterate through into the given Collection. Does not change the position of this iterator.
      Parameters:
      coll - any modifiable Collection; may have items appended into it
      Returns:
      the given collection, potentially after modifications