com.google.common.collect
Class AbstractMultisetEntry<E>
java.lang.Object
com.google.common.collect.AbstractMultisetEntry<E>
- All Implemented Interfaces:
- Multiset.Entry<E>
public abstract class AbstractMultisetEntry<E>
- extends Object
- implements Multiset.Entry<E>
Implementation of the equals, hashCode, and toString
methods of Multiset.Entry.
- Author:
- Mike Bostock
AbstractMultisetEntry
public AbstractMultisetEntry()
equals
public boolean equals(Object o)
- Description copied from interface:
Multiset.Entry
-
Returns true if the given object is also a multiset entry and
the two entries represent the same element and count. More formally, two
entries a and b are equal if:
((a.getElement() == null)
? (b.getElement() == null) : a.getElement().equals(b.getElement()))
&& (a.getCount() == b.getCount())
- Specified by:
equals in interface Multiset.Entry<E>- Overrides:
equals in class Object
hashCode
public int hashCode()
- Description copied from interface:
Multiset.Entry
-
The hash code of a multiset entry e is defined to be:
((e.getElement() == null) ? 0 : e.getElement().hashCode())
^ e.getCount()
- Specified by:
hashCode in interface Multiset.Entry<E>- Overrides:
hashCode in class Object
toString
public String toString()
-
Returns a string representation of this multiset entry. The string
representation consists of the associated element if the associated count
is one, and otherwise the associated element followed by the characters " x
" (space, x and space) followed by the count. Elements and counts are
converted to strings as by String.valueOf.
- Overrides:
toString in class Object