Class ForwardingMultiset.StandardElementSet

    • Constructor Detail

    • Method Detail

      • contains

        public boolean contains​(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 Collection<E>
        Specified by:
        contains in interface Set<E>
        Overrides:
        contains in class AbstractCollection<E>
        Parameters:
        o - element whose presence in this collection is to be tested
        Returns:
        true if this collection contains the specified element
      • remove

        public boolean remove​(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 Collection<E>
        Specified by:
        remove in interface Set<E>
        Overrides:
        remove in class AbstractCollection<E>
        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 Collection<E>
        Specified by:
        size in interface Set<E>
        Specified by:
        size in class AbstractCollection<E>
        Returns:
        the number of elements in this collection
      • removeAll

        public boolean removeAll​(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 Collection<E>
        Specified by:
        removeAll in interface Set<E>
        Overrides:
        removeAll in class AbstractSet<E>
        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)