blob: 37bb3d47f59ba064cf4c730b104ac0056b9e1164 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0-google-internal) on Wed Dec 09 09:28:17 PST 2009 -->
<TITLE>
Multiset.Entry (Google Collections Library 1.0-rc5)
</TITLE>
<META NAME="date" CONTENT="2009-12-09">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Multiset.Entry (Google Collections Library 1.0-rc5)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Multiset.Entry.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../com/google/common/collect/Multisets.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/google/common/collect/Multiset.Entry.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Multiset.Entry.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.google.common.collect</FONT>
<BR>
Interface Multiset.Entry&lt;E&gt;</H2>
<DL>
<DT><B>Enclosing interface:</B><DD><A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;<A HREF="../../../../com/google/common/collect/Multiset.html" title="type parameter in Multiset">E</A>&gt;</DD>
</DL>
<HR>
<DL>
<DT><PRE>public static interface <B>Multiset.Entry&lt;E&gt;</B></DL>
</PRE>
<P>
An unmodifiable element-count pair for a multiset. The <A HREF="../../../../com/google/common/collect/Multiset.html#entrySet()"><CODE>Multiset.entrySet()</CODE></A> method returns a view of the multiset whose elements
are of this class. A multiset implementation may return Entry instances
that are either live "read-through" views to the Multiset, or immutable
snapshots. Note that this type is unrelated to the similarly-named type
<code>Map.Entry</code>.
<P>
<P>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/collect/Multiset.Entry.html#equals(java.lang.Object)">equals</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;o)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Indicates whether some other object is "equal to" this one.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/collect/Multiset.Entry.html#getCount()">getCount</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the count of the associated element in the underlying multiset.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../com/google/common/collect/Multiset.Entry.html" title="type parameter in Multiset.Entry">E</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/collect/Multiset.Entry.html#getElement()">getElement</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the multiset element corresponding to this entry.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/collect/Multiset.Entry.html#hashCode()">hashCode</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a hash code value for the object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/collect/Multiset.Entry.html#toString()">toString</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the canonical string representation of this entry, defined as
follows.</TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="getElement()"><!-- --></A><H3>
getElement</H3>
<PRE>
<A HREF="../../../../com/google/common/collect/Multiset.Entry.html" title="type parameter in Multiset.Entry">E</A> <B>getElement</B>()</PRE>
<DL>
<DD>Returns the multiset element corresponding to this entry. Multiple calls
to this method always return the same instance.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the element corresponding to this entry</DL>
</DD>
</DL>
<HR>
<A NAME="getCount()"><!-- --></A><H3>
getCount</H3>
<PRE>
int <B>getCount</B>()</PRE>
<DL>
<DD>Returns the count of the associated element in the underlying multiset.
This count may either be an unchanging snapshot of the count at the time
the entry was retrieved, or a live view of the current count of the
element in the multiset, depending on the implementation. Note that in
the former case, this method can never return zero, while in the latter,
it will return zero if all occurrences of the element were since removed
from the multiset.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the count of the element; never negative</DL>
</DD>
</DL>
<HR>
<A NAME="equals(java.lang.Object)"><!-- --></A><H3>
equals</H3>
<PRE>
boolean <B>equals</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;o)</PRE>
<DL>
<DD>Indicates whether some other object is "equal to" this one.
<p>
The <code>equals</code> method implements an equivalence relation
on non-null object references:
<ul>
<li>It is <i>reflexive</i>: for any non-null reference value
<code>x</code>, <code>x.equals(x)</code> should return
<code>true</code>.
<li>It is <i>symmetric</i>: for any non-null reference values
<code>x</code> and <code>y</code>, <code>x.equals(y)</code>
should return <code>true</code> if and only if
<code>y.equals(x)</code> returns <code>true</code>.
<li>It is <i>transitive</i>: for any non-null reference values
<code>x</code>, <code>y</code>, and <code>z</code>, if
<code>x.equals(y)</code> returns <code>true</code> and
<code>y.equals(z)</code> returns <code>true</code>, then
<code>x.equals(z)</code> should return <code>true</code>.
<li>It is <i>consistent</i>: for any non-null reference values
<code>x</code> and <code>y</code>, multiple invocations of
<tt>x.equals(y)</tt> consistently return <code>true</code>
or consistently return <code>false</code>, provided no
information used in <code>equals</code> comparisons on the
objects is modified.
<li>For any non-null reference value <code>x</code>,
<code>x.equals(null)</code> should return <code>false</code>.
</ul>
<p>
The <tt>equals</tt> method for class <code>Object</code> implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values <code>x</code> and
<code>y</code>, this method returns <code>true</code> if and only
if <code>x</code> and <code>y</code> refer to the same object
(<code>x == y</code> has the value <code>true</code>).
<p>
Note that it is generally necessary to override the <tt>hashCode</tt>
method whenever this method is overridden, so as to maintain the
general contract for the <tt>hashCode</tt> method, which states
that equal objects must have equal hash codes.
TODO: check this wrt TreeMultiset
<p>Returns <code>true</code> if the given object is also a multiset entry and
the two entries represent the same element and count. More formally, two
entries <code>a</code> and <code>b</code> are equal if:
<pre> ((a.getElement() == null)
? (b.getElement() == null) : a.getElement().equals(b.getElement()))
&& (a.getCount() == b.getCount())</pre>
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A></CODE> in class <CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>o</CODE> - the reference object with which to compare.
<DT><B>Returns:</B><DD><code>true</code> if this object is the same as the obj
argument; <code>false</code> otherwise.<DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang"><CODE>Object.hashCode()</CODE></A>,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Hashtable.html?is-external=true" title="class or interface in java.util"><CODE>Hashtable</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="hashCode()"><!-- --></A><H3>
hashCode</H3>
<PRE>
int <B>hashCode</B>()</PRE>
<DL>
<DD>Returns a hash code value for the object. This method is
supported for the benefit of hashtables such as those provided by
<code>java.util.Hashtable</code>.
<p>
The general contract of <code>hashCode</code> is:
<ul>
<li>Whenever it is invoked on the same object more than once during
an execution of a Java application, the <tt>hashCode</tt> method
must consistently return the same integer, provided no information
used in <tt>equals</tt> comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
<li>If two objects are equal according to the <tt>equals(Object)</tt>
method, then calling the <code>hashCode</code> method on each of
the two objects must produce the same integer result.
<li>It is <em>not</em> required that if two objects are unequal
according to the <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang"><CODE>Object.equals(java.lang.Object)</CODE></A>
method, then calling the <tt>hashCode</tt> method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
</ul>
<p>
As much as is reasonably practical, the hashCode method defined by
class <tt>Object</tt> does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java<font size="-2"><sup>TM</sup></font> programming language.)
<p>The hash code of a multiset entry for element <code>element</code> and
count <code>count</code> is defined as:
<pre> (element == null ? 0 : element.hashCode()) ^ count</pre>
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A></CODE> in class <CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a hash code value for this object.<DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang"><CODE>Object.equals(java.lang.Object)</CODE></A>,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Hashtable.html?is-external=true" title="class or interface in java.util"><CODE>Hashtable</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>toString</B>()</PRE>
<DL>
<DD>Returns the canonical string representation of this entry, defined as
follows. If the count for this entry is one, this is simply the string
representation of the corresponding element. Otherwise, it is the string
representation of the element, followed by the three characters <code>" x "</code> (space, letter x, space), followed by the count.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A></CODE> in class <CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a string representation of the object.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Multiset.Entry.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../com/google/common/collect/Multisets.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/google/common/collect/Multiset.Entry.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Multiset.Entry.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>