Class ForwardingMultiset.StandardElementSet

    • Constructor Summary

      Constructors 
      Constructor Description
      StandardElementSet()
      Constructor for use by subclasses.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Removes all of the elements from this collection (optional operation).
      boolean contains​(java.lang.Object o)
      Returns true if this collection contains the specified element.
      boolean containsAll​(java.util.Collection<?> c)
      Returns true if this collection contains all of the elements in the specified collection.
      boolean isEmpty()
      Returns true if this collection contains no elements.
      java.util.Iterator<E> iterator()
      Returns an iterator over the elements contained in this collection.
      boolean remove​(java.lang.Object o)
      Removes a single instance of the specified element from this collection, if it is present (optional operation).
      boolean removeAll​(java.util.Collection<?> c)
      Removes from this set all of its elements that are contained in the specified collection (optional operation).
      boolean retainAll​(java.util.Collection<?> c)
      Retains only the elements in this collection that are contained in the specified collection (optional operation).
      int size()
      Returns the number of elements in this collection.
      • Methods inherited from class java.util.AbstractSet

        equals, hashCode
      • Methods inherited from class java.util.AbstractCollection

        add, addAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        add, addAll, spliterator, toArray, toArray
    • Constructor Detail

    • Method Detail

      • iterator

        public java.util.Iterator<Eiterator()
        Description copied from class: java.util.AbstractCollection
        Returns an iterator over the elements contained in this collection.
        Specified by:
        iterator in interface java.util.Collection<E extends @Nullable java.lang.Object>
        Specified by:
        iterator in interface java.lang.Iterable<E extends @Nullable java.lang.Object>
        Specified by:
        iterator in interface java.util.Set<E extends @Nullable java.lang.Object>
        Returns:
        an iterator over the elements contained in this collection
      • clear

        public void clear()
        Description copied from class: java.util.AbstractCollection
        Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
        Specified by:
        clear in interface java.util.Collection<E extends @Nullable java.lang.Object>
        Specified by:
        clear in interface java.util.Set<E extends @Nullable java.lang.Object>
        Overrides:
        clear in class java.util.AbstractCollection<E extends @Nullable java.lang.Object>
      • contains

        public boolean contains​(@CheckForNull
                                java.lang.Object o)
        Description copied from class: java.util.AbstractCollection
        Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that Objects.equals(o, e).
        Specified by:
        contains in interface java.util.Collection<E extends @Nullable java.lang.Object>
        Specified by:
        contains in interface java.util.Set<E extends @Nullable java.lang.Object>
        Overrides:
        contains in class java.util.AbstractCollection<E extends @Nullable java.lang.Object>
        Parameters:
        o - element whose presence in this collection is to be tested
        Returns:
        true if this collection contains the specified element
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Description copied from class: java.util.AbstractCollection
        Returns true if this collection contains all of the elements in the specified collection.
        Specified by:
        containsAll in interface java.util.Collection<E extends @Nullable java.lang.Object>
        Specified by:
        containsAll in interface java.util.Set<E extends @Nullable java.lang.Object>
        Overrides:
        containsAll in class java.util.AbstractCollection<E extends @Nullable java.lang.Object>
        Parameters:
        c - collection to be checked for containment in this collection
        Returns:
        true if this collection contains all of the elements in the specified collection
        See Also:
        AbstractCollection.contains(Object)
      • isEmpty

        public boolean isEmpty()
        Description copied from class: java.util.AbstractCollection
        Returns true if this collection contains no elements.
        Specified by:
        isEmpty in interface java.util.Collection<E extends @Nullable java.lang.Object>
        Specified by:
        isEmpty in interface java.util.Set<E extends @Nullable java.lang.Object>
        Overrides:
        isEmpty in class java.util.AbstractCollection<E extends @Nullable java.lang.Object>
        Returns:
        true if this collection contains no elements
      • remove

        public boolean remove​(@CheckForNull
                              java.lang.Object o)
        Description copied from class: java.util.AbstractCollection
        Removes a single instance of the specified element from this collection, if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this collection contains one or more such elements. Returns true if this collection contained the specified element (or equivalently, if this collection changed as a result of the call).
        Specified by:
        remove in interface java.util.Collection<E extends @Nullable java.lang.Object>
        Specified by:
        remove in interface java.util.Set<E extends @Nullable java.lang.Object>
        Overrides:
        remove in class java.util.AbstractCollection<E extends @Nullable java.lang.Object>
        Parameters:
        o - element to be removed from this collection, if present
        Returns:
        true if an element was removed as a result of this call
      • size

        public int size()
        Description copied from interface: java.util.Collection
        Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
        Specified by:
        size in interface java.util.Collection<E extends @Nullable java.lang.Object>
        Specified by:
        size in interface java.util.Set<E extends @Nullable java.lang.Object>
        Specified by:
        size in class java.util.AbstractCollection<E extends @Nullable java.lang.Object>
        Returns:
        the number of elements in this collection
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Description copied from class: java.util.AbstractSet
        Removes from this set all of its elements that are contained in the specified collection (optional operation). If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.

        This implementation determines which is the smaller of this set and the specified collection, by invoking the size method on each. If this set has fewer elements, then the implementation iterates over this set, checking each element returned by the iterator in turn to see if it is contained in the specified collection. If it is so contained, it is removed from this set with the iterator's remove method. If the specified collection has fewer elements, then the implementation iterates over the specified collection, removing from this set each element returned by the iterator, using this set's remove method.

        Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method.

        Specified by:
        removeAll in interface java.util.Collection<E extends @Nullable java.lang.Object>
        Specified by:
        removeAll in interface java.util.Set<E extends @Nullable java.lang.Object>
        Overrides:
        removeAll in class java.util.AbstractSet<E extends @Nullable java.lang.Object>
        Parameters:
        c - collection containing elements to be removed from this set
        Returns:
        true if this set changed as a result of the call
        See Also:
        AbstractCollection.remove(Object), AbstractCollection.contains(Object)
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Description copied from class: java.util.AbstractCollection
        Retains only the elements in this collection that are contained in the specified collection (optional operation). In other words, removes from this collection all of its elements that are not contained in the specified collection.
        Specified by:
        retainAll in interface java.util.Collection<E extends @Nullable java.lang.Object>
        Specified by:
        retainAll in interface java.util.Set<E extends @Nullable java.lang.Object>
        Overrides:
        retainAll in class java.util.AbstractCollection<E extends @Nullable java.lang.Object>
        Parameters:
        c - collection containing elements to be retained in this collection
        Returns:
        true if this collection changed as a result of the call
        See Also:
        AbstractCollection.remove(Object), AbstractCollection.contains(Object)