Home | History | Annotate | Download | only in collect
      1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      2 <!--NewPage-->
      3 <HTML>
      4 <HEAD>
      5 <!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:47:59 PST 2010 -->
      6 <TITLE>
      7 Multisets (Guava Libraries 2010.01.04)
      8 </TITLE>
      9 
     10 <META NAME="date" CONTENT="2010-01-04">
     11 
     12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
     13 
     14 <SCRIPT type="text/javascript">
     15 function windowTitle()
     16 {
     17     if (location.href.indexOf('is-external=true') == -1) {
     18         parent.document.title="Multisets (Guava Libraries 2010.01.04)";
     19     }
     20 }
     21 </SCRIPT>
     22 <NOSCRIPT>
     23 </NOSCRIPT>
     24 
     25 </HEAD>
     26 
     27 <BODY BGCOLOR="white" onload="windowTitle();">
     28 <HR>
     29 
     30 
     31 <!-- ========= START OF TOP NAVBAR ======= -->
     32 <A NAME="navbar_top"><!-- --></A>
     33 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
     34 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
     35 <TR>
     36 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
     37 <A NAME="navbar_top_firstrow"><!-- --></A>
     38 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
     39   <TR ALIGN="center" VALIGN="top">
     40   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
     41   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
     42   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
     43   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Multisets.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
     44   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
     45   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
     46   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
     47   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
     48   </TR>
     49 </TABLE>
     50 </TD>
     51 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
     52 </EM>
     53 </TD>
     54 </TR>
     55 
     56 <TR>
     57 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
     58 &nbsp;<A HREF="../../../../com/google/common/collect/Multiset.Entry.html" title="interface in com.google.common.collect"><B>PREV CLASS</B></A>&nbsp;
     59 &nbsp;<A HREF="../../../../com/google/common/collect/MutableClassToInstanceMap.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD>
     60 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
     61   <A HREF="../../../../index.html?com/google/common/collect/Multisets.html" target="_top"><B>FRAMES</B></A>  &nbsp;
     62 &nbsp;<A HREF="Multisets.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
     63 &nbsp;<SCRIPT type="text/javascript">
     64   <!--
     65   if(window==top) {
     66     document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
     67   }
     68   //-->
     69 </SCRIPT>
     70 <NOSCRIPT>
     71   <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
     72 </NOSCRIPT>
     73 
     74 
     75 </FONT></TD>
     76 </TR>
     77 <TR>
     78 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
     79   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
     80 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
     81 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
     82 </TR>
     83 </TABLE>
     84 <A NAME="skip-navbar_top"></A>
     85 <!-- ========= END OF TOP NAVBAR ========= -->
     86 
     87 <HR>
     88 <!-- ======== START OF CLASS DATA ======== -->
     89 <H2>
     90 <FONT SIZE="-1">
     91 com.google.common.collect</FONT>
     92 <BR>
     93 Class Multisets</H2>
     94 <PRE>
     95 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
     96   <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.collect.Multisets</B>
     97 </PRE>
     98 <HR>
     99 <DL>
    100 <DT><PRE>public final class <B>Multisets</B><DT>extends <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></DL>
    101 </PRE>
    102 
    103 <P>
    104 Provides static utility methods for creating and working with <A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect"><CODE>Multiset</CODE></A> instances.
    105 <P>
    106 
    107 <P>
    108 <DL>
    109 <DT><B>Since:</B></DT>
    110   <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD>
    111 <DT><B>Author:</B></DT>
    112   <DD>Kevin Bourrillion, Mike Bostock</DD>
    113 </DL>
    114 <HR>
    115 
    116 <P>
    117 
    118 <!-- ========== METHOD SUMMARY =========== -->
    119 
    120 <A NAME="method_summary"><!-- --></A>
    121 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    122 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    123 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
    124 <B>Method Summary</B></FONT></TH>
    125 </TR>
    126 <TR BGCOLOR="white" CLASS="TableRowColor">
    127 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    128 <CODE>static
    129 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    130 <TR ALIGN="right" VALIGN="">
    131 <TD NOWRAP><FONT SIZE="-1">
    132 <CODE>&lt;E&gt; <A HREF="../../../../com/google/common/collect/Multiset.Entry.html" title="interface in com.google.common.collect">Multiset.Entry</A>&lt;E&gt;</CODE></FONT></TD>
    133 </TR>
    134 </TABLE>
    135 </CODE></FONT></TD>
    136 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Multisets.html#immutableEntry(E, int)">immutableEntry</A></B>(E&nbsp;e,
    137                int&nbsp;n)</CODE>
    138 
    139 <BR>
    140 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an immutable multiset entry with the specified element and count.</TD>
    141 </TR>
    142 <TR BGCOLOR="white" CLASS="TableRowColor">
    143 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    144 <CODE>static
    145 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    146 <TR ALIGN="right" VALIGN="">
    147 <TD NOWRAP><FONT SIZE="-1">
    148 <CODE>&lt;E&gt; <A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;E&gt;</CODE></FONT></TD>
    149 </TR>
    150 </TABLE>
    151 </CODE></FONT></TD>
    152 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Multisets.html#intersection(com.google.common.collect.Multiset, com.google.common.collect.Multiset)">intersection</A></B>(<A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;E&gt;&nbsp;multiset1,
    153              <A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;?&gt;&nbsp;multiset2)</CODE>
    154 
    155 <BR>
    156 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable <b>view</b> of the intersection of two multisets.</TD>
    157 </TR>
    158 <TR BGCOLOR="white" CLASS="TableRowColor">
    159 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    160 <CODE>static
    161 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    162 <TR ALIGN="right" VALIGN="">
    163 <TD NOWRAP><FONT SIZE="-1">
    164 <CODE>&lt;E&gt; <A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;E&gt;</CODE></FONT></TD>
    165 </TR>
    166 </TABLE>
    167 </CODE></FONT></TD>
    168 <TD><CODE><B><A HREF="../../../../com/google/common/collect/Multisets.html#unmodifiableMultiset(com.google.common.collect.Multiset)">unmodifiableMultiset</A></B>(<A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;? extends E&gt;&nbsp;multiset)</CODE>
    169 
    170 <BR>
    171 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable view of the specified multiset.</TD>
    172 </TR>
    173 </TABLE>
    174 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
    175 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    176 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
    177 <TH ALIGN="left"><B>Methods inherited from class java.lang.<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></B></TH>
    178 </TR>
    179 <TR BGCOLOR="white" CLASS="TableRowColor">
    180 <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <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>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <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>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <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>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
    181 </TR>
    182 </TABLE>
    183 &nbsp;
    184 <P>
    185 
    186 <!-- ============ METHOD DETAIL ========== -->
    187 
    188 <A NAME="method_detail"><!-- --></A>
    189 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    190 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    191 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
    192 <B>Method Detail</B></FONT></TH>
    193 </TR>
    194 </TABLE>
    195 
    196 <A NAME="unmodifiableMultiset(com.google.common.collect.Multiset)"><!-- --></A><H3>
    197 unmodifiableMultiset</H3>
    198 <PRE>
    199 public static &lt;E&gt; <A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;E&gt; <B>unmodifiableMultiset</B>(<A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;? extends E&gt;&nbsp;multiset)</PRE>
    200 <DL>
    201 <DD>Returns an unmodifiable view of the specified multiset. Query operations on
    202  the returned multiset "read through" to the specified multiset, and
    203  attempts to modify the returned multiset result in an
    204  <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/UnsupportedOperationException.html?is-external=true" title="class or interface in java.lang"><CODE>UnsupportedOperationException</CODE></A>.
    205 
    206  <p>The returned multiset will be serializable if the specified multiset is
    207  serializable.
    208 <P>
    209 <DD><DL>
    210 <DT><B>Parameters:</B><DD><CODE>multiset</CODE> - the multiset for which an unmodifiable view is to be
    211      generated
    212 <DT><B>Returns:</B><DD>an unmodifiable view of the multiset</DL>
    213 </DD>
    214 </DL>
    215 <HR>
    216 
    217 <A NAME="immutableEntry(java.lang.Object,int)"><!-- --></A><A NAME="immutableEntry(E, int)"><!-- --></A><H3>
    218 immutableEntry</H3>
    219 <PRE>
    220 public static &lt;E&gt; <A HREF="../../../../com/google/common/collect/Multiset.Entry.html" title="interface in com.google.common.collect">Multiset.Entry</A>&lt;E&gt; <B>immutableEntry</B>(<FONT SIZE="-1"><A HREF="http://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/Nullable.html?is-external=true" title="class or interface in javax.annotation">@Nullable</A></FONT>
    221                                                    E&nbsp;e,
    222                                                    int&nbsp;n)</PRE>
    223 <DL>
    224 <DD>Returns an immutable multiset entry with the specified element and count.
    225 <P>
    226 <DD><DL>
    227 <DT><B>Parameters:</B><DD><CODE>e</CODE> - the element to be associated with the returned entry<DD><CODE>n</CODE> - the count to be associated with the returned entry
    228 <DT><B>Throws:</B>
    229 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>n</code> is negative</DL>
    230 </DD>
    231 </DL>
    232 <HR>
    233 
    234 <A NAME="intersection(com.google.common.collect.Multiset, com.google.common.collect.Multiset)"><!-- --></A><H3>
    235 intersection</H3>
    236 <PRE>
    237 public static &lt;E&gt; <A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;E&gt; <B>intersection</B>(<A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;E&gt;&nbsp;multiset1,
    238                                            <A HREF="../../../../com/google/common/collect/Multiset.html" title="interface in com.google.common.collect">Multiset</A>&lt;?&gt;&nbsp;multiset2)</PRE>
    239 <DL>
    240 <DD>Returns an unmodifiable <b>view</b> of the intersection of two multisets.
    241  An element's count in the multiset is the smaller of its counts in the two
    242  backing multisets. The iteration order of the returned multiset matches the
    243  element set of <code>multiset1</code>, with repeated occurrences of the same
    244  element appearing consecutively.
    245 
    246  <p>Results are undefined if <code>multiset1</code> and <code>multiset2</code> are
    247  based on different equivalence relations (as <code>HashMultiset</code> and
    248  <code>TreeMultiset</code> are).
    249 <P>
    250 <DD><DL>
    251 <DT><B>Since:</B></DT>
    252   <DD>2010.01.04 <b>tentative</b></DD>
    253 </DL>
    254 </DD>
    255 </DL>
    256 <!-- ========= END OF CLASS DATA ========= -->
    257 <HR>
    258 
    259 
    260 <!-- ======= START OF BOTTOM NAVBAR ====== -->
    261 <A NAME="navbar_bottom"><!-- --></A>
    262 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
    263 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
    264 <TR>
    265 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
    266 <A NAME="navbar_bottom_firstrow"><!-- --></A>
    267 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
    268   <TR ALIGN="center" VALIGN="top">
    269   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
    270   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
    271   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
    272   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Multisets.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
    273   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
    274   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
    275   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
    276   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
    277   </TR>
    278 </TABLE>
    279 </TD>
    280 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
    281 </EM>
    282 </TD>
    283 </TR>
    284 
    285 <TR>
    286 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    287 &nbsp;<A HREF="../../../../com/google/common/collect/Multiset.Entry.html" title="interface in com.google.common.collect"><B>PREV CLASS</B></A>&nbsp;
    288 &nbsp;<A HREF="../../../../com/google/common/collect/MutableClassToInstanceMap.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD>
    289 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    290   <A HREF="../../../../index.html?com/google/common/collect/Multisets.html" target="_top"><B>FRAMES</B></A>  &nbsp;
    291 &nbsp;<A HREF="Multisets.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
    292 &nbsp;<SCRIPT type="text/javascript">
    293   <!--
    294   if(window==top) {
    295     document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
    296   }
    297   //-->
    298 </SCRIPT>
    299 <NOSCRIPT>
    300   <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
    301 </NOSCRIPT>
    302 
    303 
    304 </FONT></TD>
    305 </TR>
    306 <TR>
    307 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    308   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
    309 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    310 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
    311 </TR>
    312 </TABLE>
    313 <A NAME="skip-navbar_bottom"></A>
    314 <!-- ======== END OF BOTTOM NAVBAR ======= -->
    315 
    316 <HR>
    317 
    318 </BODY>
    319 </HTML>
    320