• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>
7Sets (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">
15function windowTitle()
16{
17    if (location.href.indexOf('is-external=true') == -1) {
18        parent.document.title="Sets (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/Sets.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/SetMultimap.html" title="interface in com.google.common.collect"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../com/google/common/collect/Sets.SetView.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/Sets.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="Sets.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;<A HREF="#nested_class_summary">NESTED</A>&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">
81DETAIL:&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">
91com.google.common.collect</FONT>
92<BR>
93Class Sets</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.Sets</B>
97</PRE>
98<HR>
99<DL>
100<DT><PRE>public final class <B>Sets</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>
104Static utility methods pertaining to <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><CODE>Set</CODE></A> instances. Also see this
105 class's counterparts <A HREF="../../../../com/google/common/collect/Lists.html" title="class in com.google.common.collect"><CODE>Lists</CODE></A> and <A HREF="../../../../com/google/common/collect/Maps.html" title="class in com.google.common.collect"><CODE>Maps</CODE></A>.
106<P>
107
108<P>
109<DL>
110<DT><B>Since:</B></DT>
111  <DD>2010.01.04 <b>stable</b> (imported from Google Collections Library)</DD>
112<DT><B>Author:</B></DT>
113  <DD>Kevin Bourrillion, Jared Levy</DD>
114</DL>
115<HR>
116
117<P>
118<!-- ======== NESTED CLASS SUMMARY ======== -->
119
120<A NAME="nested_class_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>Nested Class 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&nbsp;class</CODE></FONT></TD>
129<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.SetView.html" title="class in com.google.common.collect">Sets.SetView</A>&lt;<A HREF="../../../../com/google/common/collect/Sets.SetView.html" title="type parameter in Sets.SetView">E</A>&gt;</B></CODE>
130
131<BR>
132&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An unmodifiable view of a set which may be backed by other sets; this view
133 will change as the backing sets do.</TD>
134</TR>
135</TABLE>
136&nbsp;
137<!-- ========== METHOD SUMMARY =========== -->
138
139<A NAME="method_summary"><!-- --></A>
140<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
141<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
142<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
143<B>Method Summary</B></FONT></TH>
144</TR>
145<TR BGCOLOR="white" CLASS="TableRowColor">
146<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
147<CODE>static
148<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
149<TR ALIGN="right" VALIGN="">
150<TD NOWRAP><FONT SIZE="-1">
151<CODE>&lt;B&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;B&gt;&gt;</CODE></FONT></TD>
152</TR>
153</TABLE>
154</CODE></FONT></TD>
155<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#cartesianProduct(java.util.List)">cartesianProduct</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;? extends B&gt;&gt;&nbsp;sets)</CODE>
156
157<BR>
158&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns every possible list that can be formed by choosing one element
159 from each of the given sets in order; the "n-ary
160 <a href="http://en.wikipedia.org/wiki/Cartesian_product">Cartesian
161 product</a>" of the sets.</TD>
162</TR>
163<TR BGCOLOR="white" CLASS="TableRowColor">
164<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
165<CODE>static
166<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
167<TR ALIGN="right" VALIGN="">
168<TD NOWRAP><FONT SIZE="-1">
169<CODE>&lt;B&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;B&gt;&gt;</CODE></FONT></TD>
170</TR>
171</TABLE>
172</CODE></FONT></TD>
173<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#cartesianProduct(java.util.Set...)">cartesianProduct</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;? extends B&gt;...&nbsp;sets)</CODE>
174
175<BR>
176&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns every possible list that can be formed by choosing one element
177 from each of the given sets in order; the "n-ary
178 <a href="http://en.wikipedia.org/wiki/Cartesian_product">Cartesian
179 product</a>" of the sets.</TD>
180</TR>
181<TR BGCOLOR="white" CLASS="TableRowColor">
182<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
183<CODE>static
184<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
185<TR ALIGN="right" VALIGN="">
186<TD NOWRAP><FONT SIZE="-1">
187<CODE>&lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt;
188<BR>
189<A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util">EnumSet</A>&lt;E&gt;</CODE></FONT></TD>
190</TR>
191</TABLE>
192</CODE></FONT></TD>
193<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#complementOf(java.util.Collection)">complementOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;E&gt;&nbsp;collection)</CODE>
194
195<BR>
196&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an <code>EnumSet</code> consisting of all enum values that are not in
197 the specified collection.</TD>
198</TR>
199<TR BGCOLOR="white" CLASS="TableRowColor">
200<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
201<CODE>static
202<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
203<TR ALIGN="right" VALIGN="">
204<TD NOWRAP><FONT SIZE="-1">
205<CODE>&lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt;
206<BR>
207<A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util">EnumSet</A>&lt;E&gt;</CODE></FONT></TD>
208</TR>
209</TABLE>
210</CODE></FONT></TD>
211<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#complementOf(java.util.Collection, java.lang.Class)">complementOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;E&gt;&nbsp;collection,
212             <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;E&gt;&nbsp;type)</CODE>
213
214<BR>
215&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an <code>EnumSet</code> consisting of all enum values that are not in
216 the specified collection.</TD>
217</TR>
218<TR BGCOLOR="white" CLASS="TableRowColor">
219<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
220<CODE>static
221<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
222<TR ALIGN="right" VALIGN="">
223<TD NOWRAP><FONT SIZE="-1">
224<CODE>&lt;E&gt; <A HREF="../../../../com/google/common/collect/Sets.SetView.html" title="class in com.google.common.collect">Sets.SetView</A>&lt;E&gt;</CODE></FONT></TD>
225</TR>
226</TABLE>
227</CODE></FONT></TD>
228<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#difference(java.util.Set, java.util.Set)">difference</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt;&nbsp;set1,
229           <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;?&gt;&nbsp;set2)</CODE>
230
231<BR>
232&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable <b>view</b> of the difference of two sets.</TD>
233</TR>
234<TR BGCOLOR="white" CLASS="TableRowColor">
235<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
236<CODE>static
237<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
238<TR ALIGN="right" VALIGN="">
239<TD NOWRAP><FONT SIZE="-1">
240<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt;</CODE></FONT></TD>
241</TR>
242</TABLE>
243</CODE></FONT></TD>
244<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#filter(java.util.Set, com.google.common.base.Predicate)">filter</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt;&nbsp;unfiltered,
245       <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super E&gt;&nbsp;predicate)</CODE>
246
247<BR>
248&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the elements of <code>unfiltered</code> that satisfy a predicate.</TD>
249</TR>
250<TR BGCOLOR="white" CLASS="TableRowColor">
251<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
252<CODE>static
253<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
254<TR ALIGN="right" VALIGN="">
255<TD NOWRAP><FONT SIZE="-1">
256<CODE>&lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt;
257<BR>
258<A HREF="../../../../com/google/common/collect/ImmutableSet.html" title="class in com.google.common.collect">ImmutableSet</A>&lt;E&gt;</CODE></FONT></TD>
259</TR>
260</TABLE>
261</CODE></FONT></TD>
262<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#immutableEnumSet(E, E...)">immutableEnumSet</A></B>(E&nbsp;anElement,
263                 E...&nbsp;otherElements)</CODE>
264
265<BR>
266&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an immutable set instance containing the given enum elements.</TD>
267</TR>
268<TR BGCOLOR="white" CLASS="TableRowColor">
269<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
270<CODE>static
271<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
272<TR ALIGN="right" VALIGN="">
273<TD NOWRAP><FONT SIZE="-1">
274<CODE>&lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt;
275<BR>
276<A HREF="../../../../com/google/common/collect/ImmutableSet.html" title="class in com.google.common.collect">ImmutableSet</A>&lt;E&gt;</CODE></FONT></TD>
277</TR>
278</TABLE>
279</CODE></FONT></TD>
280<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#immutableEnumSet(java.lang.Iterable)">immutableEnumSet</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;E&gt;&nbsp;elements)</CODE>
281
282<BR>
283&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an immutable set instance containing the given enum elements.</TD>
284</TR>
285<TR BGCOLOR="white" CLASS="TableRowColor">
286<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
287<CODE>static
288<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
289<TR ALIGN="right" VALIGN="">
290<TD NOWRAP><FONT SIZE="-1">
291<CODE>&lt;E&gt; <A HREF="../../../../com/google/common/collect/Sets.SetView.html" title="class in com.google.common.collect">Sets.SetView</A>&lt;E&gt;</CODE></FONT></TD>
292</TR>
293</TABLE>
294</CODE></FONT></TD>
295<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#intersection(java.util.Set, java.util.Set)">intersection</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt;&nbsp;set1,
296             <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;?&gt;&nbsp;set2)</CODE>
297
298<BR>
299&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable <b>view</b> of the intersection of two sets.</TD>
300</TR>
301<TR BGCOLOR="white" CLASS="TableRowColor">
302<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
303<CODE>static
304<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
305<TR ALIGN="right" VALIGN="">
306<TD NOWRAP><FONT SIZE="-1">
307<CODE>&lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt;
308<BR>
309<A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util">EnumSet</A>&lt;E&gt;</CODE></FONT></TD>
310</TR>
311</TABLE>
312</CODE></FONT></TD>
313<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newEnumSet(java.lang.Iterable, java.lang.Class)">newEnumSet</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;E&gt;&nbsp;iterable,
314           <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;E&gt;&nbsp;elementType)</CODE>
315
316<BR>
317&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a new <code>EnumSet</code> instance containing the given elements.</TD>
318</TR>
319<TR BGCOLOR="white" CLASS="TableRowColor">
320<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
321<CODE>static
322<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
323<TR ALIGN="right" VALIGN="">
324<TD NOWRAP><FONT SIZE="-1">
325<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt;</CODE></FONT></TD>
326</TR>
327</TABLE>
328</CODE></FONT></TD>
329<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newHashSet()">newHashSet</A></B>()</CODE>
330
331<BR>
332&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <i>mutable</i>, empty <code>HashSet</code> instance.</TD>
333</TR>
334<TR BGCOLOR="white" CLASS="TableRowColor">
335<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
336<CODE>static
337<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
338<TR ALIGN="right" VALIGN="">
339<TD NOWRAP><FONT SIZE="-1">
340<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt;</CODE></FONT></TD>
341</TR>
342</TABLE>
343</CODE></FONT></TD>
344<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newHashSet(E...)">newHashSet</A></B>(E...&nbsp;elements)</CODE>
345
346<BR>
347&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <i>mutable</i> <code>HashSet</code> instance containing the given
348 elements in unspecified order.</TD>
349</TR>
350<TR BGCOLOR="white" CLASS="TableRowColor">
351<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
352<CODE>static
353<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
354<TR ALIGN="right" VALIGN="">
355<TD NOWRAP><FONT SIZE="-1">
356<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt;</CODE></FONT></TD>
357</TR>
358</TABLE>
359</CODE></FONT></TD>
360<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newHashSet(java.lang.Iterable)">newHashSet</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;? extends E&gt;&nbsp;elements)</CODE>
361
362<BR>
363&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <i>mutable</i> <code>HashSet</code> instance containing the given
364 elements in unspecified order.</TD>
365</TR>
366<TR BGCOLOR="white" CLASS="TableRowColor">
367<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
368<CODE>static
369<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
370<TR ALIGN="right" VALIGN="">
371<TD NOWRAP><FONT SIZE="-1">
372<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt;</CODE></FONT></TD>
373</TR>
374</TABLE>
375</CODE></FONT></TD>
376<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newHashSet(java.util.Iterator)">newHashSet</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A>&lt;? extends E&gt;&nbsp;elements)</CODE>
377
378<BR>
379&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <i>mutable</i> <code>HashSet</code> instance containing the given
380 elements in unspecified order.</TD>
381</TR>
382<TR BGCOLOR="white" CLASS="TableRowColor">
383<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
384<CODE>static
385<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
386<TR ALIGN="right" VALIGN="">
387<TD NOWRAP><FONT SIZE="-1">
388<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt;</CODE></FONT></TD>
389</TR>
390</TABLE>
391</CODE></FONT></TD>
392<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newHashSetWithExpectedSize(int)">newHashSetWithExpectedSize</A></B>(int&nbsp;expectedSize)</CODE>
393
394<BR>
395&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an empty <code>HashSet</code> instance with enough capacity to hold the
396 specified number of elements without rehashing.</TD>
397</TR>
398<TR BGCOLOR="white" CLASS="TableRowColor">
399<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
400<CODE>static
401<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
402<TR ALIGN="right" VALIGN="">
403<TD NOWRAP><FONT SIZE="-1">
404<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/LinkedHashSet.html?is-external=true" title="class or interface in java.util">LinkedHashSet</A>&lt;E&gt;</CODE></FONT></TD>
405</TR>
406</TABLE>
407</CODE></FONT></TD>
408<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newLinkedHashSet()">newLinkedHashSet</A></B>()</CODE>
409
410<BR>
411&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <i>mutable</i>, empty <code>LinkedHashSet</code> instance.</TD>
412</TR>
413<TR BGCOLOR="white" CLASS="TableRowColor">
414<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
415<CODE>static
416<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
417<TR ALIGN="right" VALIGN="">
418<TD NOWRAP><FONT SIZE="-1">
419<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/LinkedHashSet.html?is-external=true" title="class or interface in java.util">LinkedHashSet</A>&lt;E&gt;</CODE></FONT></TD>
420</TR>
421</TABLE>
422</CODE></FONT></TD>
423<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newLinkedHashSet(java.lang.Iterable)">newLinkedHashSet</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;? extends E&gt;&nbsp;elements)</CODE>
424
425<BR>
426&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <i>mutable</i> <code>LinkedHashSet</code> instance containing the
427 given elements in order.</TD>
428</TR>
429<TR BGCOLOR="white" CLASS="TableRowColor">
430<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
431<CODE>static
432<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
433<TR ALIGN="right" VALIGN="">
434<TD NOWRAP><FONT SIZE="-1">
435<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt;</CODE></FONT></TD>
436</TR>
437</TABLE>
438</CODE></FONT></TD>
439<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newSetFromMap(java.util.Map)">newSetFromMap</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;E,<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</A>&gt;&nbsp;map)</CODE>
440
441<BR>
442&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a set backed by the specified map.</TD>
443</TR>
444<TR BGCOLOR="white" CLASS="TableRowColor">
445<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
446<CODE>static
447<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
448<TR ALIGN="right" VALIGN="">
449<TD NOWRAP><FONT SIZE="-1">
450<CODE>&lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>&gt;
451<BR>
452<A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html?is-external=true" title="class or interface in java.util">TreeSet</A>&lt;E&gt;</CODE></FONT></TD>
453</TR>
454</TABLE>
455</CODE></FONT></TD>
456<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newTreeSet()">newTreeSet</A></B>()</CODE>
457
458<BR>
459&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <i>mutable</i>, empty <code>TreeSet</code> instance sorted by the
460 natural sort ordering of its elements.</TD>
461</TR>
462<TR BGCOLOR="white" CLASS="TableRowColor">
463<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
464<CODE>static
465<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
466<TR ALIGN="right" VALIGN="">
467<TD NOWRAP><FONT SIZE="-1">
468<CODE>&lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html?is-external=true" title="class or interface in java.util">TreeSet</A>&lt;E&gt;</CODE></FONT></TD>
469</TR>
470</TABLE>
471</CODE></FONT></TD>
472<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newTreeSet(java.util.Comparator)">newTreeSet</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A>&lt;? super E&gt;&nbsp;comparator)</CODE>
473
474<BR>
475&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <i>mutable</i>, empty <code>TreeSet</code> instance with the given
476 comparator.</TD>
477</TR>
478<TR BGCOLOR="white" CLASS="TableRowColor">
479<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
480<CODE>static
481<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
482<TR ALIGN="right" VALIGN="">
483<TD NOWRAP><FONT SIZE="-1">
484<CODE>&lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>&gt;
485<BR>
486<A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html?is-external=true" title="class or interface in java.util">TreeSet</A>&lt;E&gt;</CODE></FONT></TD>
487</TR>
488</TABLE>
489</CODE></FONT></TD>
490<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#newTreeSet(java.lang.Iterable)">newTreeSet</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;? extends E&gt;&nbsp;elements)</CODE>
491
492<BR>
493&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <i>mutable</i> <code>TreeSet</code> instance containing the given
494 elements sorted by their natural ordering.</TD>
495</TR>
496<TR BGCOLOR="white" CLASS="TableRowColor">
497<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
498<CODE>static
499<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
500<TR ALIGN="right" VALIGN="">
501<TD NOWRAP><FONT SIZE="-1">
502<CODE>&lt;E&gt; <A HREF="../../../../com/google/common/collect/Sets.SetView.html" title="class in com.google.common.collect">Sets.SetView</A>&lt;E&gt;</CODE></FONT></TD>
503</TR>
504</TABLE>
505</CODE></FONT></TD>
506<TD><CODE><B><A HREF="../../../../com/google/common/collect/Sets.html#union(java.util.Set, java.util.Set)">union</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;? extends E&gt;&nbsp;set1,
507      <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;? extends E&gt;&nbsp;set2)</CODE>
508
509<BR>
510&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable <b>view</b> of the union of two sets.</TD>
511</TR>
512</TABLE>
513&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
514<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
515<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
516<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>
517</TR>
518<TR BGCOLOR="white" CLASS="TableRowColor">
519<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>
520</TR>
521</TABLE>
522&nbsp;
523<P>
524
525<!-- ============ METHOD DETAIL ========== -->
526
527<A NAME="method_detail"><!-- --></A>
528<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
529<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
530<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
531<B>Method Detail</B></FONT></TH>
532</TR>
533</TABLE>
534
535<A NAME="immutableEnumSet(java.lang.Enum,java.lang.Enum[])"><!-- --></A><A NAME="immutableEnumSet(E, E...)"><!-- --></A><H3>
536immutableEnumSet</H3>
537<PRE>
538public static &lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt; <A HREF="../../../../com/google/common/collect/ImmutableSet.html" title="class in com.google.common.collect">ImmutableSet</A>&lt;E&gt; <B>immutableEnumSet</B>(E&nbsp;anElement,
539                                                                   E...&nbsp;otherElements)</PRE>
540<DL>
541<DD>Returns an immutable set instance containing the given enum elements.
542 Internally, the returned set will be backed by an <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util"><CODE>EnumSet</CODE></A>.
543
544 <p>The iteration order of the returned set follows the enum's iteration
545 order, not the order in which the elements are provided to the method.
546<P>
547<DD><DL>
548<DT><B>Parameters:</B><DD><CODE>anElement</CODE> - one of the elements the set should contain<DD><CODE>otherElements</CODE> - the rest of the elements the set should contain
549<DT><B>Returns:</B><DD>an immutable set containing those elements, minus duplicates</DL>
550</DD>
551</DL>
552<HR>
553
554<A NAME="immutableEnumSet(java.lang.Iterable)"><!-- --></A><H3>
555immutableEnumSet</H3>
556<PRE>
557public static &lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt; <A HREF="../../../../com/google/common/collect/ImmutableSet.html" title="class in com.google.common.collect">ImmutableSet</A>&lt;E&gt; <B>immutableEnumSet</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;E&gt;&nbsp;elements)</PRE>
558<DL>
559<DD>Returns an immutable set instance containing the given enum elements.
560 Internally, the returned set will be backed by an <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util"><CODE>EnumSet</CODE></A>.
561
562 <p>The iteration order of the returned set follows the enum's iteration
563 order, not the order in which the elements appear in the given collection.
564<P>
565<DD><DL>
566<DT><B>Parameters:</B><DD><CODE>elements</CODE> - the elements, all of the same <code>enum</code> type, that the
567     set should contain
568<DT><B>Returns:</B><DD>an immutable set containing those elements, minus duplicates</DL>
569</DD>
570</DL>
571<HR>
572
573<A NAME="newEnumSet(java.lang.Iterable, java.lang.Class)"><!-- --></A><H3>
574newEnumSet</H3>
575<PRE>
576public static &lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util">EnumSet</A>&lt;E&gt; <B>newEnumSet</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;E&gt;&nbsp;iterable,
577                                                        <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;E&gt;&nbsp;elementType)</PRE>
578<DL>
579<DD>Returns a new <code>EnumSet</code> instance containing the given elements.
580 Unlike <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true#copyOf(java.util.Collection)" title="class or interface in java.util"><CODE>EnumSet.copyOf(Collection)</CODE></A>, this method does not produce an
581 exception on an empty collection, and it may be called on any iterable, not
582 just a <code>Collection</code>.
583<P>
584<DD><DL>
585</DL>
586</DD>
587</DL>
588<HR>
589
590<A NAME="newHashSet()"><!-- --></A><H3>
591newHashSet</H3>
592<PRE>
593public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt; <B>newHashSet</B>()</PRE>
594<DL>
595<DD>Creates a <i>mutable</i>, empty <code>HashSet</code> instance.
596
597 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableSet.html#of()"><CODE>ImmutableSet.of()</CODE></A> instead.
598
599 <p><b>Note:</b> if <code>E</code> is an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang"><CODE>Enum</CODE></A> type, use <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true#noneOf(java.lang.Class)" title="class or interface in java.util"><CODE>EnumSet.noneOf(java.lang.Class<E>)</CODE></A> instead.
600<P>
601<DD><DL>
602
603<DT><B>Returns:</B><DD>a new, empty <code>HashSet</code></DL>
604</DD>
605</DL>
606<HR>
607
608<A NAME="newHashSet(java.lang.Object[])"><!-- --></A><A NAME="newHashSet(E...)"><!-- --></A><H3>
609newHashSet</H3>
610<PRE>
611public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt; <B>newHashSet</B>(E...&nbsp;elements)</PRE>
612<DL>
613<DD>Creates a <i>mutable</i> <code>HashSet</code> instance containing the given
614 elements in unspecified order.
615
616 <p><b>Note:</b> if mutability is not required and the elements are
617 non-null, use <A HREF="../../../../com/google/common/collect/ImmutableSet.html#of(E...)"><CODE>ImmutableSet.of(Object[])</CODE></A> instead.
618
619 <p><b>Note:</b> if <code>E</code> is an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang"><CODE>Enum</CODE></A> type, use <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true#of(E, E...)" title="class or interface in java.util"><CODE>EnumSet.of(Enum, Enum[])</CODE></A> instead.
620<P>
621<DD><DL>
622<DT><B>Parameters:</B><DD><CODE>elements</CODE> - the elements that the set should contain
623<DT><B>Returns:</B><DD>a new <code>HashSet</code> containing those elements (minus duplicates)</DL>
624</DD>
625</DL>
626<HR>
627
628<A NAME="newHashSetWithExpectedSize(int)"><!-- --></A><H3>
629newHashSetWithExpectedSize</H3>
630<PRE>
631public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt; <B>newHashSetWithExpectedSize</B>(int&nbsp;expectedSize)</PRE>
632<DL>
633<DD>Creates an empty <code>HashSet</code> instance with enough capacity to hold the
634 specified number of elements without rehashing.
635<P>
636<DD><DL>
637<DT><B>Parameters:</B><DD><CODE>expectedSize</CODE> - the expected size
638<DT><B>Returns:</B><DD>a new, empty <code>HashSet</code> with enough capacity to hold <code>expectedSize</code> elements without rehashing
639<DT><B>Throws:</B>
640<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>expectedSize</code> is negative</DL>
641</DD>
642</DL>
643<HR>
644
645<A NAME="newHashSet(java.lang.Iterable)"><!-- --></A><H3>
646newHashSet</H3>
647<PRE>
648public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt; <B>newHashSet</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;? extends E&gt;&nbsp;elements)</PRE>
649<DL>
650<DD>Creates a <i>mutable</i> <code>HashSet</code> instance containing the given
651 elements in unspecified order.
652
653 <p><b>Note:</b> if mutability is not required and the elements are
654 non-null, use <A HREF="../../../../com/google/common/collect/ImmutableSet.html#copyOf(java.lang.Iterable)"><CODE>ImmutableSet.copyOf(Iterable)</CODE></A> instead.
655
656 <p><b>Note:</b> if <code>E</code> is an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang"><CODE>Enum</CODE></A> type, use
657 <A HREF="../../../../com/google/common/collect/Sets.html#newEnumSet(java.lang.Iterable, java.lang.Class)"><CODE>newEnumSet(Iterable, Class)</CODE></A> instead.
658<P>
659<DD><DL>
660<DT><B>Parameters:</B><DD><CODE>elements</CODE> - the elements that the set should contain
661<DT><B>Returns:</B><DD>a new <code>HashSet</code> containing those elements (minus duplicates)</DL>
662</DD>
663</DL>
664<HR>
665
666<A NAME="newHashSet(java.util.Iterator)"><!-- --></A><H3>
667newHashSet</H3>
668<PRE>
669public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util">HashSet</A>&lt;E&gt; <B>newHashSet</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A>&lt;? extends E&gt;&nbsp;elements)</PRE>
670<DL>
671<DD>Creates a <i>mutable</i> <code>HashSet</code> instance containing the given
672 elements in unspecified order.
673
674 <p><b>Note:</b> if mutability is not required and the elements are
675 non-null, use <A HREF="../../../../com/google/common/collect/ImmutableSet.html#copyOf(java.lang.Iterable)"><CODE>ImmutableSet.copyOf(Iterable)</CODE></A> instead.
676
677 <p><b>Note:</b> if <code>E</code> is an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang"><CODE>Enum</CODE></A> type, you should create an
678 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util"><CODE>EnumSet</CODE></A> instead.
679<P>
680<DD><DL>
681<DT><B>Parameters:</B><DD><CODE>elements</CODE> - the elements that the set should contain
682<DT><B>Returns:</B><DD>a new <code>HashSet</code> containing those elements (minus duplicates)</DL>
683</DD>
684</DL>
685<HR>
686
687<A NAME="newLinkedHashSet()"><!-- --></A><H3>
688newLinkedHashSet</H3>
689<PRE>
690public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/LinkedHashSet.html?is-external=true" title="class or interface in java.util">LinkedHashSet</A>&lt;E&gt; <B>newLinkedHashSet</B>()</PRE>
691<DL>
692<DD>Creates a <i>mutable</i>, empty <code>LinkedHashSet</code> instance.
693
694 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableSet.html#of()"><CODE>ImmutableSet.of()</CODE></A> instead.
695<P>
696<DD><DL>
697
698<DT><B>Returns:</B><DD>a new, empty <code>LinkedHashSet</code></DL>
699</DD>
700</DL>
701<HR>
702
703<A NAME="newLinkedHashSet(java.lang.Iterable)"><!-- --></A><H3>
704newLinkedHashSet</H3>
705<PRE>
706public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/LinkedHashSet.html?is-external=true" title="class or interface in java.util">LinkedHashSet</A>&lt;E&gt; <B>newLinkedHashSet</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;? extends E&gt;&nbsp;elements)</PRE>
707<DL>
708<DD>Creates a <i>mutable</i> <code>LinkedHashSet</code> instance containing the
709 given elements in order.
710
711 <p><b>Note:</b> if mutability is not required and the elements are
712 non-null, use <A HREF="../../../../com/google/common/collect/ImmutableSet.html#copyOf(java.lang.Iterable)"><CODE>ImmutableSet.copyOf(Iterable)</CODE></A> instead.
713<P>
714<DD><DL>
715<DT><B>Parameters:</B><DD><CODE>elements</CODE> - the elements that the set should contain, in order
716<DT><B>Returns:</B><DD>a new <code>LinkedHashSet</code> containing those elements (minus
717     duplicates)</DL>
718</DD>
719</DL>
720<HR>
721
722<A NAME="newTreeSet()"><!-- --></A><H3>
723newTreeSet</H3>
724<PRE>
725public static &lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html?is-external=true" title="class or interface in java.util">TreeSet</A>&lt;E&gt; <B>newTreeSet</B>()</PRE>
726<DL>
727<DD>Creates a <i>mutable</i>, empty <code>TreeSet</code> instance sorted by the
728 natural sort ordering of its elements.
729
730 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableSortedSet.html#of()"><CODE>ImmutableSortedSet.of()</CODE></A> instead.
731<P>
732<DD><DL>
733
734<DT><B>Returns:</B><DD>a new, empty <code>TreeSet</code></DL>
735</DD>
736</DL>
737<HR>
738
739<A NAME="newTreeSet(java.lang.Iterable)"><!-- --></A><H3>
740newTreeSet</H3>
741<PRE>
742public static &lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html?is-external=true" title="class or interface in java.util">TreeSet</A>&lt;E&gt; <B>newTreeSet</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;? extends E&gt;&nbsp;elements)</PRE>
743<DL>
744<DD>Creates a <i>mutable</i> <code>TreeSet</code> instance containing the given
745 elements sorted by their natural ordering.
746
747 <p><b>Note:</b> if mutability is not required, use <A HREF="../../../../com/google/common/collect/ImmutableSortedSet.html#copyOf(java.lang.Iterable)"><CODE>ImmutableSortedSet.copyOf(Iterable)</CODE></A> instead.
748
749 <p><b>Note:</b> If <code>elements</code> is a <code>SortedSet</code> with an explicit
750 comparator, this method has different behavior than
751 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html?is-external=true#TreeSet(java.util.SortedSet)" title="class or interface in java.util"><CODE>TreeSet.TreeSet(SortedSet)</CODE></A>, which returns a <code>TreeSet</code> with
752 that comparator.
753<P>
754<DD><DL>
755<DT><B>Parameters:</B><DD><CODE>elements</CODE> - the elements that the set should contain
756<DT><B>Returns:</B><DD>a new <code>TreeSet</code> containing those elements (minus duplicates)</DL>
757</DD>
758</DL>
759<HR>
760
761<A NAME="newTreeSet(java.util.Comparator)"><!-- --></A><H3>
762newTreeSet</H3>
763<PRE>
764public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html?is-external=true" title="class or interface in java.util">TreeSet</A>&lt;E&gt; <B>newTreeSet</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A>&lt;? super E&gt;&nbsp;comparator)</PRE>
765<DL>
766<DD>Creates a <i>mutable</i>, empty <code>TreeSet</code> instance with the given
767 comparator.
768
769 <p><b>Note:</b> if mutability is not required, use <code>ImmutableSortedSet.orderedBy(comparator).build()</code> instead.
770<P>
771<DD><DL>
772<DT><B>Parameters:</B><DD><CODE>comparator</CODE> - the comparator to use to sort the set
773<DT><B>Returns:</B><DD>a new, empty <code>TreeSet</code>
774<DT><B>Throws:</B>
775<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>comparator</code> is null</DL>
776</DD>
777</DL>
778<HR>
779
780<A NAME="complementOf(java.util.Collection)"><!-- --></A><H3>
781complementOf</H3>
782<PRE>
783public static &lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util">EnumSet</A>&lt;E&gt; <B>complementOf</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;E&gt;&nbsp;collection)</PRE>
784<DL>
785<DD>Creates an <code>EnumSet</code> consisting of all enum values that are not in
786 the specified collection. If the collection is an <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util"><CODE>EnumSet</CODE></A>, this
787 method has the same behavior as <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true#complementOf(java.util.EnumSet)" title="class or interface in java.util"><CODE>EnumSet.complementOf(java.util.EnumSet<E>)</CODE></A>. Otherwise,
788 the specified collection must contain at least one element, in order to
789 determine the element type. If the collection could be empty, use
790 <A HREF="../../../../com/google/common/collect/Sets.html#complementOf(java.util.Collection, java.lang.Class)"><CODE>complementOf(Collection, Class)</CODE></A> instead of this method.
791<P>
792<DD><DL>
793<DT><B>Parameters:</B><DD><CODE>collection</CODE> - the collection whose complement should be stored in the
794     enum set
795<DT><B>Returns:</B><DD>a new, modifiable <code>EnumSet</code> containing all values of the enum
796     that aren't present in the given collection
797<DT><B>Throws:</B>
798<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>collection</code> is not an
799     <code>EnumSet</code> instance and contains no elements</DL>
800</DD>
801</DL>
802<HR>
803
804<A NAME="complementOf(java.util.Collection, java.lang.Class)"><!-- --></A><H3>
805complementOf</H3>
806<PRE>
807public static &lt;E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</A>&lt;E&gt;&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true" title="class or interface in java.util">EnumSet</A>&lt;E&gt; <B>complementOf</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;E&gt;&nbsp;collection,
808                                                          <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;E&gt;&nbsp;type)</PRE>
809<DL>
810<DD>Creates an <code>EnumSet</code> consisting of all enum values that are not in
811 the specified collection. This is equivalent to
812 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/EnumSet.html?is-external=true#complementOf(java.util.EnumSet)" title="class or interface in java.util"><CODE>EnumSet.complementOf(java.util.EnumSet<E>)</CODE></A>, but can act on any input collection, as long
813 as the elements are of enum type.
814<P>
815<DD><DL>
816<DT><B>Parameters:</B><DD><CODE>collection</CODE> - the collection whose complement should be stored in the
817     <code>EnumSet</code><DD><CODE>type</CODE> - the type of the elements in the set
818<DT><B>Returns:</B><DD>a new, modifiable <code>EnumSet</code> initially containing all the
819     values of the enum not present in the given collection</DL>
820</DD>
821</DL>
822<HR>
823
824<A NAME="newSetFromMap(java.util.Map)"><!-- --></A><H3>
825newSetFromMap</H3>
826<PRE>
827public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt; <B>newSetFromMap</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A>&lt;E,<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Boolean.html?is-external=true" title="class or interface in java.lang">Boolean</A>&gt;&nbsp;map)</PRE>
828<DL>
829<DD>Returns a set backed by the specified map. The resulting set displays
830 the same ordering, concurrency, and performance characteristics as the
831 backing map. In essence, this factory method provides a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><CODE>Set</CODE></A>
832 implementation corresponding to any <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util"><CODE>Map</CODE></A> implementation. There is no
833 need to use this method on a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util"><CODE>Map</CODE></A> implementation that already has a
834 corresponding <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util"><CODE>Set</CODE></A> implementation (such as <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashMap.html?is-external=true" title="class or interface in java.util"><CODE>HashMap</CODE></A> or
835 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html?is-external=true" title="class or interface in java.util"><CODE>TreeMap</CODE></A>).
836
837 <p>Each method invocation on the set returned by this method results in
838 exactly one method invocation on the backing map or its <tt>keySet</tt>
839 view, with one exception. The <tt>addAll</tt> method is implemented as a
840 sequence of <tt>put</tt> invocations on the backing map.
841
842 <p>The specified map must be empty at the time this method is invoked,
843 and should not be accessed directly after this method returns. These
844 conditions are ensured if the map is created empty, passed directly
845 to this method, and no reference to the map is retained, as illustrated
846 in the following code fragment: <pre>  <code>Set&lt;Object&gt; identityHashSet = Sets.newSetFromMap(
847      new IdentityHashMap&lt;Object, Boolean&gt;());</code></pre>
848
849 This method has the same behavior as the JDK 6 method
850 <code>Collections.newSetFromMap()</code>. The returned set is serializable if
851 the backing map is.
852<P>
853<DD><DL>
854<DT><B>Parameters:</B><DD><CODE>map</CODE> - the backing map
855<DT><B>Returns:</B><DD>the set backed by the map
856<DT><B>Throws:</B>
857<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 <tt>map</tt> is not empty</DL>
858</DD>
859</DL>
860<HR>
861
862<A NAME="union(java.util.Set, java.util.Set)"><!-- --></A><H3>
863union</H3>
864<PRE>
865public static &lt;E&gt; <A HREF="../../../../com/google/common/collect/Sets.SetView.html" title="class in com.google.common.collect">Sets.SetView</A>&lt;E&gt; <B>union</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;? extends E&gt;&nbsp;set1,
866                                        <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;? extends E&gt;&nbsp;set2)</PRE>
867<DL>
868<DD>Returns an unmodifiable <b>view</b> of the union of two sets. The returned
869 set contains all elements that are contained in either backing set.
870 Iterating over the returned set iterates first over all the elements of
871 <code>set1</code>, then over each element of <code>set2</code>, in order, that is not
872 contained in <code>set1</code>.
873
874 <p>Results are undefined if <code>set1</code> and <code>set2</code> are sets based on
875 different equivalence relations (as <A HREF="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html?is-external=true" title="class or interface in java.util"><CODE>HashSet</CODE></A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/TreeSet.html?is-external=true" title="class or interface in java.util"><CODE>TreeSet</CODE></A>, and
876 the <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true#keySet()" title="class or interface in java.util"><CODE>Map.keySet()</CODE></A> of an <A HREF="http://java.sun.com/javase/6/docs/api/java/util/IdentityHashMap.html?is-external=true" title="class or interface in java.util"><CODE>IdentityHashMap</CODE></A> all are).
877
878 <p><b>Note:</b> The returned view performs better when <code>set1</code> is the
879 smaller of the two sets. If you have reason to believe one of your sets
880 will generally be smaller than the other, pass it first.
881<P>
882<DD><DL>
883</DL>
884</DD>
885</DL>
886<HR>
887
888<A NAME="intersection(java.util.Set, java.util.Set)"><!-- --></A><H3>
889intersection</H3>
890<PRE>
891public static &lt;E&gt; <A HREF="../../../../com/google/common/collect/Sets.SetView.html" title="class in com.google.common.collect">Sets.SetView</A>&lt;E&gt; <B>intersection</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt;&nbsp;set1,
892                                               <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;?&gt;&nbsp;set2)</PRE>
893<DL>
894<DD>Returns an unmodifiable <b>view</b> of the intersection of two sets. The
895 returned set contains all elements that are contained by both backing sets.
896 The iteration order of the returned set matches that of <code>set1</code>.
897
898 <p>Results are undefined if <code>set1</code> and <code>set2</code> are sets based
899 on different equivalence relations (as <code>HashSet</code>, <code>TreeSet</code>,
900 and the keySet of an <code>IdentityHashMap</code> all are).
901
902 <p><b>Note:</b> The returned view performs slightly better when <code>set1</code> is the smaller of the two sets. If you have reason to believe one of
903 your sets will generally be smaller than the other, pass it first.
904 Unfortunately, since this method sets the generic type of the returned set
905 based on the type of the first set passed, this could in rare cases force
906 you to make a cast, for example: <pre>  <code>Set&lt;Object&gt; aFewBadObjects = ...
907  Set&lt;String&gt; manyBadStrings = ...
908
909  // impossible for a non-String to be in the intersection
910  SuppressWarnings("unchecked")
911  Set&lt;String&gt; badStrings = (Set) Sets.intersection(
912      aFewBadObjects, manyBadStrings);</code></pre>
913
914 This is unfortunate, but should come up only very rarely.
915<P>
916<DD><DL>
917</DL>
918</DD>
919</DL>
920<HR>
921
922<A NAME="difference(java.util.Set, java.util.Set)"><!-- --></A><H3>
923difference</H3>
924<PRE>
925public static &lt;E&gt; <A HREF="../../../../com/google/common/collect/Sets.SetView.html" title="class in com.google.common.collect">Sets.SetView</A>&lt;E&gt; <B>difference</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt;&nbsp;set1,
926                                             <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;?&gt;&nbsp;set2)</PRE>
927<DL>
928<DD>Returns an unmodifiable <b>view</b> of the difference of two sets. The
929 returned set contains all elements that are contained by <code>set1</code> and
930 not contained by <code>set2</code>. <code>set2</code> may also contain elements not
931 present in <code>set1</code>; these are simply ignored. The iteration order of
932 the returned set matches that of <code>set1</code>.
933
934 <p>Results are undefined if <code>set1</code> and <code>set2</code> are sets based
935 on different equivalence relations (as <code>HashSet</code>, <code>TreeSet</code>,
936 and the keySet of an <code>IdentityHashMap</code> all are).
937<P>
938<DD><DL>
939</DL>
940</DD>
941</DL>
942<HR>
943
944<A NAME="filter(java.util.Set, com.google.common.base.Predicate)"><!-- --></A><H3>
945filter</H3>
946<PRE>
947public static &lt;E&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt; <B>filter</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;E&gt;&nbsp;unfiltered,
948                                <A HREF="../../../../com/google/common/base/Predicate.html" title="interface in com.google.common.base">Predicate</A>&lt;? super E&gt;&nbsp;predicate)</PRE>
949<DL>
950<DD>Returns the elements of <code>unfiltered</code> that satisfy a predicate. The
951 returned set is a live view of <code>unfiltered</code>; changes to one affect
952 the other.
953
954 <p>The resulting set's iterator does not support <code>remove()</code>, but all
955 other set methods are supported. The set's <code>add()</code> and
956 <code>addAll()</code> methods throw an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang"><CODE>IllegalArgumentException</CODE></A> if an
957 element that doesn't satisfy the predicate is provided. When methods such
958 as <code>removeAll()</code> and <code>clear()</code> are called on the filtered set,
959 only elements that satisfy the filter will be removed from the underlying
960 collection.
961
962 <p>The returned set isn't threadsafe or serializable, even if
963 <code>unfiltered</code> is.
964
965 <p>Many of the filtered set's methods, such as <code>size()</code>, iterate
966 across every element in the underlying set and determine which elements
967 satisfy the filter. When a live view is <i>not</i> needed, it may be faster
968 to copy <code>Iterables.filter(unfiltered, predicate)</code> and use the copy.
969<P>
970<DD><DL>
971</DL>
972</DD>
973</DL>
974<HR>
975
976<A NAME="cartesianProduct(java.util.List)"><!-- --></A><H3>
977cartesianProduct</H3>
978<PRE>
979public static &lt;B&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;B&gt;&gt; <B>cartesianProduct</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;? extends B&gt;&gt;&nbsp;sets)</PRE>
980<DL>
981<DD>Returns every possible list that can be formed by choosing one element
982 from each of the given sets in order; the "n-ary
983 <a href="http://en.wikipedia.org/wiki/Cartesian_product">Cartesian
984 product</a>" of the sets. For example: <pre class="code">   <code>cartesianProduct(ImmutableList.of(
985       ImmutableSet.of(1, 2),
986       ImmutableSet.of("A", "B", "C")))</code></pre>
987
988 returns a set containing six lists:
989
990 <ul>
991 <li><code>ImmutableList.of(1, "A")</code>
992 <li><code>ImmutableList.of(1, "B")</code>
993 <li><code>ImmutableList.of(1, "C")</code>
994 <li><code>ImmutableList.of(2, "A")</code>
995 <li><code>ImmutableList.of(2, "B")</code>
996 <li><code>ImmutableList.of(2, "C")</code>
997 </ul>
998
999 The order in which these lists are returned is not guaranteed, however the
1000 position of an element inside a tuple always corresponds to the position of
1001 the set from which it came in the input list. Note that if any input set is
1002 empty, the Cartesian product will also be empty. If no sets at all are
1003 provided (an empty list), the resulting Cartesian product has one element,
1004 an empty list (counter-intuitive, but mathematically consistent).
1005<P>
1006<DD><DL>
1007<DT><B>Type Parameters:</B><DD><CODE>B</CODE> - any common base class shared by all axes (often just <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang"><CODE>Object</CODE></A>)<DT><B>Parameters:</B><DD><CODE>sets</CODE> - the sets to choose elements from, in the order that
1008     the elements chosen from those sets should appear in the resulting
1009     lists
1010<DT><B>Returns:</B><DD>the Cartesian product, as an immutable set containing immutable
1011     lists
1012<DT><B>Throws:</B>
1013<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>sets</code>, any one of the <code>sets</code>,
1014     or any element of a provided set is null<DT><B>Since:</B></DT>
1015  <DD>2010.01.04 <b>tentative</b></DD>
1016</DL>
1017</DD>
1018</DL>
1019<HR>
1020
1021<A NAME="cartesianProduct(java.util.Set...)"><!-- --></A><H3>
1022cartesianProduct</H3>
1023<PRE>
1024public static &lt;B&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;B&gt;&gt; <B>cartesianProduct</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</A>&lt;? extends B&gt;...&nbsp;sets)</PRE>
1025<DL>
1026<DD>Returns every possible list that can be formed by choosing one element
1027 from each of the given sets in order; the "n-ary
1028 <a href="http://en.wikipedia.org/wiki/Cartesian_product">Cartesian
1029 product</a>" of the sets. For example: <pre class="code">   <code>cartesianProduct(
1030       ImmutableSet.of(1, 2),
1031       ImmutableSet.of("A", "B", "C"))</code></pre>
1032
1033 returns a set containing six lists:
1034   w
1035 <ul>
1036 <li><code>ImmutableList.of(1, "A")</code>
1037 <li><code>ImmutableList.of(1, "B")</code>
1038 <li><code>ImmutableList.of(1, "C")</code>
1039 <li><code>ImmutableList.of(2, "A")</code>
1040 <li><code>ImmutableList.of(2, "B")</code>
1041 <li><code>ImmutableList.of(2, "C")</code>
1042 </ul>
1043
1044 The order in which these lists are returned is not guaranteed, however the
1045 position of an element inside a tuple always corresponds to the position of
1046 the set from which it came in the input list. Note that if any input set is
1047 empty, the Cartesian product will also be empty. If no sets at all are
1048 provided, the resulting Cartesian product has one element, an empty list
1049 (counter-intuitive, but mathematically consistent).
1050<P>
1051<DD><DL>
1052<DT><B>Type Parameters:</B><DD><CODE>B</CODE> - any common base class shared by all axes (often just <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang"><CODE>Object</CODE></A>)<DT><B>Parameters:</B><DD><CODE>sets</CODE> - the sets to choose elements from, in the order that
1053     the elements chosen from those sets should appear in the resulting
1054     lists
1055<DT><B>Returns:</B><DD>the Cartesian product, as an immutable set containing immutable
1056     lists
1057<DT><B>Throws:</B>
1058<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>sets</code>, any one of the <code>sets</code>,
1059     or any element of a provided set is null<DT><B>Since:</B></DT>
1060  <DD>2010.01.04 <b>tentative</b></DD>
1061</DL>
1062</DD>
1063</DL>
1064<!-- ========= END OF CLASS DATA ========= -->
1065<HR>
1066
1067
1068<!-- ======= START OF BOTTOM NAVBAR ====== -->
1069<A NAME="navbar_bottom"><!-- --></A>
1070<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
1071<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
1072<TR>
1073<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
1074<A NAME="navbar_bottom_firstrow"><!-- --></A>
1075<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
1076  <TR ALIGN="center" VALIGN="top">
1077  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
1078  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
1079  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
1080  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Sets.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
1081  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
1082  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
1083  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
1084  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
1085  </TR>
1086</TABLE>
1087</TD>
1088<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
1089</EM>
1090</TD>
1091</TR>
1092
1093<TR>
1094<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
1095&nbsp;<A HREF="../../../../com/google/common/collect/SetMultimap.html" title="interface in com.google.common.collect"><B>PREV CLASS</B></A>&nbsp;
1096&nbsp;<A HREF="../../../../com/google/common/collect/Sets.SetView.html" title="class in com.google.common.collect"><B>NEXT CLASS</B></A></FONT></TD>
1097<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
1098  <A HREF="../../../../index.html?com/google/common/collect/Sets.html" target="_top"><B>FRAMES</B></A>  &nbsp;
1099&nbsp;<A HREF="Sets.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
1100&nbsp;<SCRIPT type="text/javascript">
1101  <!--
1102  if(window==top) {
1103    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
1104  }
1105  //-->
1106</SCRIPT>
1107<NOSCRIPT>
1108  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
1109</NOSCRIPT>
1110
1111
1112</FONT></TD>
1113</TR>
1114<TR>
1115<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
1116  SUMMARY:&nbsp;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
1117<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
1118DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
1119</TR>
1120</TABLE>
1121<A NAME="skip-navbar_bottom"></A>
1122<!-- ======== END OF BOTTOM NAVBAR ======= -->
1123
1124<HR>
1125
1126</BODY>
1127</HTML>
1128