|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingCollection<E>
com.google.common.collect.ForwardingMultiset<E>
public abstract class ForwardingMultiset<E>
A multiset which forwards all its method calls to another multiset. Subclasses should override one or more methods to change or add behavior of the backing multiset as desired per the decorator pattern.
ForwardingObject,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.google.common.collect.Multiset |
|---|
Multiset.Entry<E> |
| Constructor Summary | |
|---|---|
protected |
ForwardingMultiset(Multiset<E> delegate)
|
| Method Summary | |
|---|---|
boolean |
add(E element,
int occurrences)
Adds a number of occurrences of the specified element to this multiset. |
int |
count(Object element)
Returns the number of occurrences of the specified element in this multiset. |
protected Multiset<E> |
delegate()
Returns the backing delegate object. |
Set<E> |
elementSet()
Returns a view of the elements of this multiset as a set. |
Set<Multiset.Entry<E>> |
entrySet()
Returns the data of this multiset as a set of Entry instances. |
boolean |
equals(Object obj)
Compares the specified object with this multiset for equality. |
int |
hashCode()
Returns the hash code for this multiset. |
int |
remove(Object element,
int occurrences)
Removes a number of occurrences of the specified element from this multiset. |
int |
removeAllOccurrences(Object element)
Removes all occurrences of the specified element from this multiset. |
| Methods inherited from class com.google.common.collect.ForwardingCollection |
|---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from class com.google.common.collect.ForwardingObject |
|---|
toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Constructor Detail |
|---|
protected ForwardingMultiset(Multiset<E> delegate)
| Method Detail |
|---|
protected Multiset<E> delegate()
ForwardingObject @SuppressWarnings("unchecked")
@Override protected Foo delegate() {
return (Foo) super.delegate();
}
This method should always return the same delegate instance that was passed
to the constructor.
delegate in class ForwardingCollection<E>public int count(Object element)
Multiset
count in interface Multiset<E>element - the element to look for
Iterables.frequency(java.lang.Iterable>, java.lang.Object)
public boolean add(E element,
int occurrences)
Multiset
add in interface Multiset<E>element - the element to addoccurrences - the number of occurrences to add
true if the collection changed as a result (this should
always be the case unless occurrences is zero)
public int remove(Object element,
int occurrences)
Multiset
remove in interface Multiset<E>element - the element whose occurrences should be removedoccurrences - the number of occurrences of this element to remove
public int removeAllOccurrences(Object element)
MultisetMultiset.remove(java.lang.Object, int), which removes only one
occurrence at a time.
removeAllOccurrences in interface Multiset<E>element - the element whose occurrences should all be removed
public Set<E> elementSet()
MultisetelementSet().size() to find
the number of distinct elements in this multiset.
elementSet in interface Multiset<E>public Set<Multiset.Entry<E>> entrySet()
MultisetEntry instances. This
set contains precisely one Entry instance for each distinct element
of the multiset. The iteration order of this set is
implementation-dependent.
entrySet in interface Multiset<E>public boolean equals(Object obj)
Multisettrue if the given object is also a multiset and contains equal
elements with equal counts.
equals in interface Multiset<E>equals in interface Collection<E>equals in class Objectpublic int hashCode()
Multiset(element == null ? 0 : element.hashCode()) ^ count(element)over all elements in the multiset.
hashCode in interface Multiset<E>hashCode in interface Collection<E>hashCode in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||