Class ForwardingMultiset.StandardElementSet
- java.lang.Object
- 
- java.util.AbstractCollection<E>
- 
- java.util.AbstractSet<E>
- 
- com.google.common.collect.ForwardingMultiset.StandardElementSet
 
 
 
- 
- All Implemented Interfaces:
- Iterable<E>,- Collection<E>,- Set<E>
 - Enclosing class:
- ForwardingMultiset<E extends @Nullable Object>
 
 @Beta protected class ForwardingMultiset.StandardElementSet extends AbstractSet<E> A sensible implementation ofMultiset.elementSet()in terms of the following methods:ForwardingCollection.clear(),ForwardingCollection.contains(java.lang.Object),ForwardingCollection.containsAll(java.util.Collection<?>),ForwardingMultiset.count(java.lang.Object),ForwardingCollection.isEmpty(), theSet.size()andSet.iterator()methods ofForwardingMultiset.entrySet(), andForwardingMultiset.remove(Object, int). In many situations, you may wish to overrideForwardingMultiset.elementSet()to forward to this implementation or a subclass thereof.- Since:
- 10.0
 
- 
- 
Constructor SummaryConstructors Constructor Description StandardElementSet()Constructor for use by subclasses.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all of the elements from this collection (optional operation).booleancontains(Object o)Returnstrueif this collection contains the specified element.booleancontainsAll(Collection<?> c)Returnstrueif this collection contains all of the elements in the specified collection.booleanisEmpty()Returnstrueif this collection contains no elements.Iterator<E>iterator()Returns an iterator over the elements contained in this collection.booleanremove(Object o)Removes a single instance of the specified element from this collection, if it is present (optional operation).booleanremoveAll(Collection<?> c)Removes from this set all of its elements that are contained in the specified collection (optional operation).booleanretainAll(Collection<?> c)Retains only the elements in this collection that are contained in the specified collection (optional operation).intsize()Returns the number of elements in this collection.- 
Methods inherited from class java.util.AbstractSetequals, hashCode
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.util.CollectionparallelStream, removeIf, stream, toArray
 
- 
 
- 
- 
- 
Constructor Detail- 
StandardElementSetpublic StandardElementSet() Constructor for use by subclasses.
 
- 
 - 
Method Detail- 
iteratorpublic Iterator<E> iterator() Description copied from class:java.util.AbstractCollectionReturns an iterator over the elements contained in this collection.
 - 
clearpublic void clear() Description copied from class:java.util.AbstractCollectionRemoves all of the elements from this collection (optional operation). The collection will be empty after this method returns.
 - 
containspublic boolean contains(@CheckForNull Object o) Description copied from class:java.util.AbstractCollectionReturnstrueif this collection contains the specified element. More formally, returnstrueif and only if this collection contains at least one elementesuch thatObjects.equals(o, e).- Specified by:
- containsin interface- Collection<E extends @Nullable Object>
- Specified by:
- containsin interface- Set<E extends @Nullable Object>
- Overrides:
- containsin class- AbstractCollection<E extends @Nullable Object>
- Parameters:
- o- element whose presence in this collection is to be tested
- Returns:
- trueif this collection contains the specified element
 
 - 
containsAllpublic boolean containsAll(Collection<?> c) Description copied from class:java.util.AbstractCollectionReturnstrueif this collection contains all of the elements in the specified collection.- Specified by:
- containsAllin interface- Collection<E extends @Nullable Object>
- Specified by:
- containsAllin interface- Set<E extends @Nullable Object>
- Overrides:
- containsAllin class- AbstractCollection<E extends @Nullable Object>
- Parameters:
- c- collection to be checked for containment in this collection
- Returns:
- trueif this collection contains all of the elements in the specified collection
- See Also:
- AbstractCollection.contains(Object)
 
 - 
isEmptypublic boolean isEmpty() Description copied from class:java.util.AbstractCollectionReturnstrueif this collection contains no elements.
 - 
removepublic boolean remove(@CheckForNull Object o) Description copied from class:java.util.AbstractCollectionRemoves a single instance of the specified element from this collection, if it is present (optional operation). More formally, removes an elementesuch thatObjects.equals(o, e), if this collection contains one or more such elements. Returnstrueif this collection contained the specified element (or equivalently, if this collection changed as a result of the call).- Specified by:
- removein interface- Collection<E extends @Nullable Object>
- Specified by:
- removein interface- Set<E extends @Nullable Object>
- Overrides:
- removein class- AbstractCollection<E extends @Nullable Object>
- Parameters:
- o- element to be removed from this collection, if present
- Returns:
- trueif an element was removed as a result of this call
 
 - 
sizepublic int size() Description copied from interface:java.util.CollectionReturns the number of elements in this collection. If this collection contains more thanInteger.MAX_VALUEelements, returnsInteger.MAX_VALUE.
 - 
removeAllpublic boolean removeAll(Collection<?> c) Description copied from class:java.util.AbstractSetRemoves 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 sizemethod 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'sremovemethod. 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'sremovemethod.Note that this implementation will throw an UnsupportedOperationExceptionif the iterator returned by theiteratormethod does not implement theremovemethod.- Specified by:
- removeAllin interface- Collection<E extends @Nullable Object>
- Specified by:
- removeAllin interface- Set<E extends @Nullable Object>
- Overrides:
- removeAllin class- AbstractSet<E extends @Nullable Object>
- Parameters:
- c- collection containing elements to be removed from this set
- Returns:
- trueif this set changed as a result of the call
- See Also:
- AbstractCollection.remove(Object),- AbstractCollection.contains(Object)
 
 - 
retainAllpublic boolean retainAll(Collection<?> c) Description copied from class:java.util.AbstractCollectionRetains 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:
- retainAllin interface- Collection<E extends @Nullable Object>
- Specified by:
- retainAllin interface- Set<E extends @Nullable Object>
- Overrides:
- retainAllin class- AbstractCollection<E extends @Nullable Object>
- Parameters:
- c- collection containing elements to be retained in this collection
- Returns:
- trueif this collection changed as a result of the call
- See Also:
- AbstractCollection.remove(Object),- AbstractCollection.contains(Object)
 
 
- 
 
-