a whole bunch of stuff
[ephemerata.git] / KezvhLib / lib / org.apache.commons.collections / apidocs / org / apache / commons / collections / SetUtils.html
blob9ea2eb2e1fe2cf06a1a8784be60b60d6928f5b8b
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.5.0_07) on Fri Apr 11 15:39:17 BST 2008 -->
6 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
7 <TITLE>
8 SetUtils (Commons Collections 3.2.1 API)
9 </TITLE>
11 <META NAME="keywords" CONTENT="org.apache.commons.collections.SetUtils class">
13 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
15 <SCRIPT type="text/javascript">
16 function windowTitle()
18 parent.document.title="SetUtils (Commons Collections 3.2.1 API)";
20 </SCRIPT>
21 <NOSCRIPT>
22 </NOSCRIPT>
24 </HEAD>
26 <BODY BGCOLOR="white" onload="windowTitle();">
29 <!-- ========= START OF TOP NAVBAR ======= -->
30 <A NAME="navbar_top"><!-- --></A>
31 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
32 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
33 <TR>
34 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
35 <A NAME="navbar_top_firstrow"><!-- --></A>
36 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
37 <TR ALIGN="center" VALIGN="top">
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
39 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
40 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SetUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
46 </TR>
47 </TABLE>
48 </TD>
49 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
50 </EM>
51 </TD>
52 </TR>
54 <TR>
55 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
56 &nbsp;<A HREF="../../../../org/apache/commons/collections/SequencedHashMap.html" title="class in org.apache.commons.collections"><B>PREV CLASS</B></A>&nbsp;
57 &nbsp;<A HREF="../../../../org/apache/commons/collections/SortedBag.html" title="interface in org.apache.commons.collections"><B>NEXT CLASS</B></A></FONT></TD>
58 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
59 <A HREF="../../../../index.html?org/apache/commons/collections/SetUtils.html" target="_top"><B>FRAMES</B></A> &nbsp;
60 &nbsp;<A HREF="SetUtils.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
61 &nbsp;<SCRIPT type="text/javascript">
62 <!--
63 if(window==top) {
64 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
66 //-->
67 </SCRIPT>
68 <NOSCRIPT>
69 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
70 </NOSCRIPT>
73 </FONT></TD>
74 </TR>
75 <TR>
76 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
77 SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
78 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
79 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
80 </TR>
81 </TABLE>
82 <A NAME="skip-navbar_top"></A>
83 <!-- ========= END OF TOP NAVBAR ========= -->
85 <HR>
86 <!-- ======== START OF CLASS DATA ======== -->
87 <H2>
88 <FONT SIZE="-1">
89 org.apache.commons.collections</FONT>
90 <BR>
91 Class SetUtils</H2>
92 <PRE>
93 java.lang.Object
94 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.commons.collections.SetUtils</B>
95 </PRE>
96 <HR>
97 <DL>
98 <DT><PRE>public class <B>SetUtils</B><DT>extends java.lang.Object</DL>
99 </PRE>
102 Provides utility methods and decorators for
103 <CODE>Set</CODE> and <CODE>SortedSet</CODE> instances.
107 <DL>
108 <DT><B>Since:</B></DT>
109 <DD>Commons Collections 2.1</DD>
110 <DT><B>Version:</B></DT>
111 <DD>$Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $</DD>
112 <DT><B>Author:</B></DT>
113 <DD>Paul Jack, Stephen Colebourne, Neil O'Toole, Matthew Hawthorne</DD>
114 </DL>
115 <HR>
118 <!-- =========== FIELD SUMMARY =========== -->
120 <A NAME="field_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>Field 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;java.util.Set</CODE></FONT></TD>
129 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#EMPTY_SET">EMPTY_SET</A></B></CODE>
131 <BR>
132 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An empty unmodifiable set.</TD>
133 </TR>
134 <TR BGCOLOR="white" CLASS="TableRowColor">
135 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
136 <CODE>static&nbsp;java.util.SortedSet</CODE></FONT></TD>
137 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#EMPTY_SORTED_SET">EMPTY_SORTED_SET</A></B></CODE>
139 <BR>
140 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An empty unmodifiable sorted set.</TD>
141 </TR>
142 </TABLE>
143 &nbsp;
144 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
146 <A NAME="constructor_summary"><!-- --></A>
147 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
148 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
149 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
150 <B>Constructor Summary</B></FONT></TH>
151 </TR>
152 <TR BGCOLOR="white" CLASS="TableRowColor">
153 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#SetUtils()">SetUtils</A></B>()</CODE>
155 <BR>
156 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code>SetUtils</code> should not normally be instantiated.</TD>
157 </TR>
158 </TABLE>
159 &nbsp;
160 <!-- ========== METHOD SUMMARY =========== -->
162 <A NAME="method_summary"><!-- --></A>
163 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
164 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
165 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
166 <B>Method Summary</B></FONT></TH>
167 </TR>
168 <TR BGCOLOR="white" CLASS="TableRowColor">
169 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
170 <CODE>static&nbsp;int</CODE></FONT></TD>
171 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#hashCodeForSet(java.util.Collection)">hashCodeForSet</A></B>(java.util.Collection&nbsp;set)</CODE>
173 <BR>
174 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Generates a hash code using the algorithm specified in
175 <CODE>Set.hashCode()</CODE>.</TD>
176 </TR>
177 <TR BGCOLOR="white" CLASS="TableRowColor">
178 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
179 <CODE>static&nbsp;boolean</CODE></FONT></TD>
180 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#isEqualSet(java.util.Collection, java.util.Collection)">isEqualSet</A></B>(java.util.Collection&nbsp;set1,
181 java.util.Collection&nbsp;set2)</CODE>
183 <BR>
184 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tests two sets for equality as per the <code>equals()</code> contract
185 in <CODE>Set.equals(java.lang.Object)</CODE>.</TD>
186 </TR>
187 <TR BGCOLOR="white" CLASS="TableRowColor">
188 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
189 <CODE>static&nbsp;java.util.Set</CODE></FONT></TD>
190 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#orderedSet(java.util.Set)">orderedSet</A></B>(java.util.Set&nbsp;set)</CODE>
192 <BR>
193 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a set that maintains the order of elements that are added
194 backed by the given set.</TD>
195 </TR>
196 <TR BGCOLOR="white" CLASS="TableRowColor">
197 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
198 <CODE>static&nbsp;java.util.Set</CODE></FONT></TD>
199 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#predicatedSet(java.util.Set, org.apache.commons.collections.Predicate)">predicatedSet</A></B>(java.util.Set&nbsp;set,
200 <A HREF="../../../../org/apache/commons/collections/Predicate.html" title="interface in org.apache.commons.collections">Predicate</A>&nbsp;predicate)</CODE>
202 <BR>
203 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a predicated (validating) set backed by the given set.</TD>
204 </TR>
205 <TR BGCOLOR="white" CLASS="TableRowColor">
206 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
207 <CODE>static&nbsp;java.util.SortedSet</CODE></FONT></TD>
208 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#predicatedSortedSet(java.util.SortedSet, org.apache.commons.collections.Predicate)">predicatedSortedSet</A></B>(java.util.SortedSet&nbsp;set,
209 <A HREF="../../../../org/apache/commons/collections/Predicate.html" title="interface in org.apache.commons.collections">Predicate</A>&nbsp;predicate)</CODE>
211 <BR>
212 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a predicated (validating) sorted set backed by the given sorted set.</TD>
213 </TR>
214 <TR BGCOLOR="white" CLASS="TableRowColor">
215 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
216 <CODE>static&nbsp;java.util.Set</CODE></FONT></TD>
217 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#synchronizedSet(java.util.Set)">synchronizedSet</A></B>(java.util.Set&nbsp;set)</CODE>
219 <BR>
220 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a synchronized set backed by the given set.</TD>
221 </TR>
222 <TR BGCOLOR="white" CLASS="TableRowColor">
223 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
224 <CODE>static&nbsp;java.util.SortedSet</CODE></FONT></TD>
225 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#synchronizedSortedSet(java.util.SortedSet)">synchronizedSortedSet</A></B>(java.util.SortedSet&nbsp;set)</CODE>
227 <BR>
228 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a synchronized sorted set backed by the given sorted set.</TD>
229 </TR>
230 <TR BGCOLOR="white" CLASS="TableRowColor">
231 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
232 <CODE>static&nbsp;java.util.Set</CODE></FONT></TD>
233 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#transformedSet(java.util.Set, org.apache.commons.collections.Transformer)">transformedSet</A></B>(java.util.Set&nbsp;set,
234 <A HREF="../../../../org/apache/commons/collections/Transformer.html" title="interface in org.apache.commons.collections">Transformer</A>&nbsp;transformer)</CODE>
236 <BR>
237 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a transformed set backed by the given set.</TD>
238 </TR>
239 <TR BGCOLOR="white" CLASS="TableRowColor">
240 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
241 <CODE>static&nbsp;java.util.SortedSet</CODE></FONT></TD>
242 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#transformedSortedSet(java.util.SortedSet, org.apache.commons.collections.Transformer)">transformedSortedSet</A></B>(java.util.SortedSet&nbsp;set,
243 <A HREF="../../../../org/apache/commons/collections/Transformer.html" title="interface in org.apache.commons.collections">Transformer</A>&nbsp;transformer)</CODE>
245 <BR>
246 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a transformed sorted set backed by the given set.</TD>
247 </TR>
248 <TR BGCOLOR="white" CLASS="TableRowColor">
249 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
250 <CODE>static&nbsp;java.util.Set</CODE></FONT></TD>
251 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#typedSet(java.util.Set, java.lang.Class)">typedSet</A></B>(java.util.Set&nbsp;set,
252 java.lang.Class&nbsp;type)</CODE>
254 <BR>
255 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a typed set backed by the given set.</TD>
256 </TR>
257 <TR BGCOLOR="white" CLASS="TableRowColor">
258 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
259 <CODE>static&nbsp;java.util.SortedSet</CODE></FONT></TD>
260 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#typedSortedSet(java.util.SortedSet, java.lang.Class)">typedSortedSet</A></B>(java.util.SortedSet&nbsp;set,
261 java.lang.Class&nbsp;type)</CODE>
263 <BR>
264 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a typed sorted set backed by the given set.</TD>
265 </TR>
266 <TR BGCOLOR="white" CLASS="TableRowColor">
267 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
268 <CODE>static&nbsp;java.util.Set</CODE></FONT></TD>
269 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#unmodifiableSet(java.util.Set)">unmodifiableSet</A></B>(java.util.Set&nbsp;set)</CODE>
271 <BR>
272 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable set backed by the given set.</TD>
273 </TR>
274 <TR BGCOLOR="white" CLASS="TableRowColor">
275 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
276 <CODE>static&nbsp;java.util.SortedSet</CODE></FONT></TD>
277 <TD><CODE><B><A HREF="../../../../org/apache/commons/collections/SetUtils.html#unmodifiableSortedSet(java.util.SortedSet)">unmodifiableSortedSet</A></B>(java.util.SortedSet&nbsp;set)</CODE>
279 <BR>
280 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an unmodifiable sorted set backed by the given sorted set.</TD>
281 </TR>
282 </TABLE>
283 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
284 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
285 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
286 <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
287 </TR>
288 <TR BGCOLOR="white" CLASS="TableRowColor">
289 <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
290 </TR>
291 </TABLE>
292 &nbsp;
295 <!-- ============ FIELD DETAIL =========== -->
297 <A NAME="field_detail"><!-- --></A>
298 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
299 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
300 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
301 <B>Field Detail</B></FONT></TH>
302 </TR>
303 </TABLE>
305 <A NAME="EMPTY_SET"><!-- --></A><H3>
306 EMPTY_SET</H3>
307 <PRE>
308 public static final java.util.Set <B>EMPTY_SET</B></PRE>
309 <DL>
310 <DD>An empty unmodifiable set.
311 This uses the <CODE>Collections</CODE> implementation
312 and is provided for completeness.
314 <DL>
315 </DL>
316 </DL>
317 <HR>
319 <A NAME="EMPTY_SORTED_SET"><!-- --></A><H3>
320 EMPTY_SORTED_SET</H3>
321 <PRE>
322 public static final java.util.SortedSet <B>EMPTY_SORTED_SET</B></PRE>
323 <DL>
324 <DD>An empty unmodifiable sorted set.
325 This is not provided in the JDK.
327 <DL>
328 </DL>
329 </DL>
331 <!-- ========= CONSTRUCTOR DETAIL ======== -->
333 <A NAME="constructor_detail"><!-- --></A>
334 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
335 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
336 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
337 <B>Constructor Detail</B></FONT></TH>
338 </TR>
339 </TABLE>
341 <A NAME="SetUtils()"><!-- --></A><H3>
342 SetUtils</H3>
343 <PRE>
344 public <B>SetUtils</B>()</PRE>
345 <DL>
346 <DD><code>SetUtils</code> should not normally be instantiated.
348 </DL>
350 <!-- ============ METHOD DETAIL ========== -->
352 <A NAME="method_detail"><!-- --></A>
353 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
354 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
355 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
356 <B>Method Detail</B></FONT></TH>
357 </TR>
358 </TABLE>
360 <A NAME="isEqualSet(java.util.Collection, java.util.Collection)"><!-- --></A><H3>
361 isEqualSet</H3>
362 <PRE>
363 public static boolean <B>isEqualSet</B>(java.util.Collection&nbsp;set1,
364 java.util.Collection&nbsp;set2)</PRE>
365 <DL>
366 <DD>Tests two sets for equality as per the <code>equals()</code> contract
367 in <CODE>Set.equals(java.lang.Object)</CODE>.
369 This method is useful for implementing <code>Set</code> when you cannot
370 extend AbstractSet. The method takes Collection instances to enable other
371 collection types to use the Set implementation algorithm.
373 The relevant text (slightly paraphrased as this is a static method) is:
374 <blockquote>
375 <p>Two sets are considered equal if they have
376 the same size, and every member of the first set is contained in
377 the second. This ensures that the <tt>equals</tt> method works
378 properly across different implementations of the <tt>Set</tt>
379 interface.</p>
382 This implementation first checks if the two sets are the same object:
383 if so it returns <tt>true</tt>. Then, it checks if the two sets are
384 identical in size; if not, it returns false. If so, it returns
385 <tt>a.containsAll((Collection) b)</tt>.</p>
386 </blockquote>
388 <DD><DL>
389 <DT><B>Parameters:</B><DD><CODE>set1</CODE> - the first set, may be null<DD><CODE>set2</CODE> - the second set, may be null
390 <DT><B>Returns:</B><DD>whether the sets are equal by value comparison<DT><B>See Also:</B><DD><CODE>Set</CODE></DL>
391 </DD>
392 </DL>
393 <HR>
395 <A NAME="hashCodeForSet(java.util.Collection)"><!-- --></A><H3>
396 hashCodeForSet</H3>
397 <PRE>
398 public static int <B>hashCodeForSet</B>(java.util.Collection&nbsp;set)</PRE>
399 <DL>
400 <DD>Generates a hash code using the algorithm specified in
401 <CODE>Set.hashCode()</CODE>.
403 This method is useful for implementing <code>Set</code> when you cannot
404 extend AbstractSet. The method takes Collection instances to enable other
405 collection types to use the Set implementation algorithm.
407 <DD><DL>
408 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the set to calculate the hash code for, may be null
409 <DT><B>Returns:</B><DD>the hash code<DT><B>See Also:</B><DD><CODE>Set.hashCode()</CODE></DL>
410 </DD>
411 </DL>
412 <HR>
414 <A NAME="synchronizedSet(java.util.Set)"><!-- --></A><H3>
415 synchronizedSet</H3>
416 <PRE>
417 public static java.util.Set <B>synchronizedSet</B>(java.util.Set&nbsp;set)</PRE>
418 <DL>
419 <DD>Returns a synchronized set backed by the given set.
421 You must manually synchronize on the returned buffer's iterator to
422 avoid non-deterministic behavior:
424 <pre>
425 Set s = SetUtils.synchronizedSet(mySet);
426 synchronized (s) {
427 Iterator i = s.iterator();
428 while (i.hasNext()) {
429 process (i.next());
432 </pre>
434 This method uses the implementation in the decorators subpackage.
436 <DD><DL>
437 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the set to synchronize, must not be null
438 <DT><B>Returns:</B><DD>a synchronized set backed by the given set
439 <DT><B>Throws:</B>
440 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the set is null</DL>
441 </DD>
442 </DL>
443 <HR>
445 <A NAME="unmodifiableSet(java.util.Set)"><!-- --></A><H3>
446 unmodifiableSet</H3>
447 <PRE>
448 public static java.util.Set <B>unmodifiableSet</B>(java.util.Set&nbsp;set)</PRE>
449 <DL>
450 <DD>Returns an unmodifiable set backed by the given set.
452 This method uses the implementation in the decorators subpackage.
454 <DD><DL>
455 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the set to make unmodifiable, must not be null
456 <DT><B>Returns:</B><DD>an unmodifiable set backed by the given set
457 <DT><B>Throws:</B>
458 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the set is null</DL>
459 </DD>
460 </DL>
461 <HR>
463 <A NAME="predicatedSet(java.util.Set, org.apache.commons.collections.Predicate)"><!-- --></A><H3>
464 predicatedSet</H3>
465 <PRE>
466 public static java.util.Set <B>predicatedSet</B>(java.util.Set&nbsp;set,
467 <A HREF="../../../../org/apache/commons/collections/Predicate.html" title="interface in org.apache.commons.collections">Predicate</A>&nbsp;predicate)</PRE>
468 <DL>
469 <DD>Returns a predicated (validating) set backed by the given set.
471 Only objects that pass the test in the given predicate can be added to the set.
472 Trying to add an invalid object results in an IllegalArgumentException.
473 It is important not to use the original set after invoking this method,
474 as it is a backdoor for adding invalid objects.
476 <DD><DL>
477 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the set to predicate, must not be null<DD><CODE>predicate</CODE> - the predicate for the set, must not be null
478 <DT><B>Returns:</B><DD>a predicated set backed by the given set
479 <DT><B>Throws:</B>
480 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the Set or Predicate is null</DL>
481 </DD>
482 </DL>
483 <HR>
485 <A NAME="typedSet(java.util.Set, java.lang.Class)"><!-- --></A><H3>
486 typedSet</H3>
487 <PRE>
488 public static java.util.Set <B>typedSet</B>(java.util.Set&nbsp;set,
489 java.lang.Class&nbsp;type)</PRE>
490 <DL>
491 <DD>Returns a typed set backed by the given set.
493 Only objects of the specified type can be added to the set.
495 <DD><DL>
496 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the set to limit to a specific type, must not be null<DD><CODE>type</CODE> - the type of objects which may be added to the set
497 <DT><B>Returns:</B><DD>a typed set backed by the specified set</DL>
498 </DD>
499 </DL>
500 <HR>
502 <A NAME="transformedSet(java.util.Set, org.apache.commons.collections.Transformer)"><!-- --></A><H3>
503 transformedSet</H3>
504 <PRE>
505 public static java.util.Set <B>transformedSet</B>(java.util.Set&nbsp;set,
506 <A HREF="../../../../org/apache/commons/collections/Transformer.html" title="interface in org.apache.commons.collections">Transformer</A>&nbsp;transformer)</PRE>
507 <DL>
508 <DD>Returns a transformed set backed by the given set.
510 Each object is passed through the transformer as it is added to the
511 Set. It is important not to use the original set after invoking this
512 method, as it is a backdoor for adding untransformed objects.
514 <DD><DL>
515 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the set to transform, must not be null<DD><CODE>transformer</CODE> - the transformer for the set, must not be null
516 <DT><B>Returns:</B><DD>a transformed set backed by the given set
517 <DT><B>Throws:</B>
518 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the Set or Transformer is null</DL>
519 </DD>
520 </DL>
521 <HR>
523 <A NAME="orderedSet(java.util.Set)"><!-- --></A><H3>
524 orderedSet</H3>
525 <PRE>
526 public static java.util.Set <B>orderedSet</B>(java.util.Set&nbsp;set)</PRE>
527 <DL>
528 <DD>Returns a set that maintains the order of elements that are added
529 backed by the given set.
531 If an element is added twice, the order is determined by the first add.
532 The order is observed through the iterator or toArray.
534 <DD><DL>
535 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the set to order, must not be null
536 <DT><B>Returns:</B><DD>an ordered set backed by the given set
537 <DT><B>Throws:</B>
538 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the Set is null</DL>
539 </DD>
540 </DL>
541 <HR>
543 <A NAME="synchronizedSortedSet(java.util.SortedSet)"><!-- --></A><H3>
544 synchronizedSortedSet</H3>
545 <PRE>
546 public static java.util.SortedSet <B>synchronizedSortedSet</B>(java.util.SortedSet&nbsp;set)</PRE>
547 <DL>
548 <DD>Returns a synchronized sorted set backed by the given sorted set.
550 You must manually synchronize on the returned buffer's iterator to
551 avoid non-deterministic behavior:
553 <pre>
554 Set s = SetUtils.synchronizedSet(mySet);
555 synchronized (s) {
556 Iterator i = s.iterator();
557 while (i.hasNext()) {
558 process (i.next());
561 </pre>
563 This method uses the implementation in the decorators subpackage.
565 <DD><DL>
566 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the sorted set to synchronize, must not be null
567 <DT><B>Returns:</B><DD>a synchronized set backed by the given set
568 <DT><B>Throws:</B>
569 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the set is null</DL>
570 </DD>
571 </DL>
572 <HR>
574 <A NAME="unmodifiableSortedSet(java.util.SortedSet)"><!-- --></A><H3>
575 unmodifiableSortedSet</H3>
576 <PRE>
577 public static java.util.SortedSet <B>unmodifiableSortedSet</B>(java.util.SortedSet&nbsp;set)</PRE>
578 <DL>
579 <DD>Returns an unmodifiable sorted set backed by the given sorted set.
581 This method uses the implementation in the decorators subpackage.
583 <DD><DL>
584 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the sorted set to make unmodifiable, must not be null
585 <DT><B>Returns:</B><DD>an unmodifiable set backed by the given set
586 <DT><B>Throws:</B>
587 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the set is null</DL>
588 </DD>
589 </DL>
590 <HR>
592 <A NAME="predicatedSortedSet(java.util.SortedSet, org.apache.commons.collections.Predicate)"><!-- --></A><H3>
593 predicatedSortedSet</H3>
594 <PRE>
595 public static java.util.SortedSet <B>predicatedSortedSet</B>(java.util.SortedSet&nbsp;set,
596 <A HREF="../../../../org/apache/commons/collections/Predicate.html" title="interface in org.apache.commons.collections">Predicate</A>&nbsp;predicate)</PRE>
597 <DL>
598 <DD>Returns a predicated (validating) sorted set backed by the given sorted set.
600 Only objects that pass the test in the given predicate can be added to the set.
601 Trying to add an invalid object results in an IllegalArgumentException.
602 It is important not to use the original set after invoking this method,
603 as it is a backdoor for adding invalid objects.
605 <DD><DL>
606 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the sorted set to predicate, must not be null<DD><CODE>predicate</CODE> - the predicate for the sorted set, must not be null
607 <DT><B>Returns:</B><DD>a predicated sorted set backed by the given sorted set
608 <DT><B>Throws:</B>
609 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the Set or Predicate is null</DL>
610 </DD>
611 </DL>
612 <HR>
614 <A NAME="typedSortedSet(java.util.SortedSet, java.lang.Class)"><!-- --></A><H3>
615 typedSortedSet</H3>
616 <PRE>
617 public static java.util.SortedSet <B>typedSortedSet</B>(java.util.SortedSet&nbsp;set,
618 java.lang.Class&nbsp;type)</PRE>
619 <DL>
620 <DD>Returns a typed sorted set backed by the given set.
622 Only objects of the specified type can be added to the set.
624 <DD><DL>
625 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the set to limit to a specific type, must not be null<DD><CODE>type</CODE> - the type of objects which may be added to the set
626 <DT><B>Returns:</B><DD>a typed set backed by the specified set</DL>
627 </DD>
628 </DL>
629 <HR>
631 <A NAME="transformedSortedSet(java.util.SortedSet, org.apache.commons.collections.Transformer)"><!-- --></A><H3>
632 transformedSortedSet</H3>
633 <PRE>
634 public static java.util.SortedSet <B>transformedSortedSet</B>(java.util.SortedSet&nbsp;set,
635 <A HREF="../../../../org/apache/commons/collections/Transformer.html" title="interface in org.apache.commons.collections">Transformer</A>&nbsp;transformer)</PRE>
636 <DL>
637 <DD>Returns a transformed sorted set backed by the given set.
639 Each object is passed through the transformer as it is added to the
640 Set. It is important not to use the original set after invoking this
641 method, as it is a backdoor for adding untransformed objects.
643 <DD><DL>
644 <DT><B>Parameters:</B><DD><CODE>set</CODE> - the set to transform, must not be null<DD><CODE>transformer</CODE> - the transformer for the set, must not be null
645 <DT><B>Returns:</B><DD>a transformed set backed by the given set
646 <DT><B>Throws:</B>
647 <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the Set or Transformer is null</DL>
648 </DD>
649 </DL>
650 <!-- ========= END OF CLASS DATA ========= -->
651 <HR>
654 <!-- ======= START OF BOTTOM NAVBAR ====== -->
655 <A NAME="navbar_bottom"><!-- --></A>
656 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
657 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
658 <TR>
659 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
660 <A NAME="navbar_bottom_firstrow"><!-- --></A>
661 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
662 <TR ALIGN="center" VALIGN="top">
663 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
664 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
665 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
666 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SetUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
667 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
668 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
669 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
670 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
671 </TR>
672 </TABLE>
673 </TD>
674 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
675 </EM>
676 </TD>
677 </TR>
679 <TR>
680 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
681 &nbsp;<A HREF="../../../../org/apache/commons/collections/SequencedHashMap.html" title="class in org.apache.commons.collections"><B>PREV CLASS</B></A>&nbsp;
682 &nbsp;<A HREF="../../../../org/apache/commons/collections/SortedBag.html" title="interface in org.apache.commons.collections"><B>NEXT CLASS</B></A></FONT></TD>
683 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
684 <A HREF="../../../../index.html?org/apache/commons/collections/SetUtils.html" target="_top"><B>FRAMES</B></A> &nbsp;
685 &nbsp;<A HREF="SetUtils.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
686 &nbsp;<SCRIPT type="text/javascript">
687 <!--
688 if(window==top) {
689 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
691 //-->
692 </SCRIPT>
693 <NOSCRIPT>
694 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
695 </NOSCRIPT>
698 </FONT></TD>
699 </TR>
700 <TR>
701 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
702 SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
703 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
704 DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
705 </TR>
706 </TABLE>
707 <A NAME="skip-navbar_bottom"></A>
708 <!-- ======== END OF BOTTOM NAVBAR ======= -->
710 <HR>
711 Copyright © 2001-2008 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
712 </BODY>
713 </HTML>