fixed some formatting typos
[vimdoclet.git] / sample / java.util.Collections.txt
blob57923403e7159e13e045da988fd674fdb02ee487
1 *java.util.Collections* *Collections* This class consists exclusively of static 
3 public class Collections
4   extends    |java.lang.Object|
6 |java.util.Collections_Description|
7 |java.util.Collections_Fields|
8 |java.util.Collections_Constructors|
9 |java.util.Collections_Methods|
11 ================================================================================
13 *java.util.Collections_Fields*
14 |java.util.List_java.util.Collections.EMPTY_LIST|
15 |java.util.Map_java.util.Collections.EMPTY_MAP|
16 |java.util.Set_java.util.Collections.EMPTY_SET|
18 *java.util.Collections_Methods*
19 |java.util.Collections.addAll(Collection<?superT>,T...)|Adds all of the specifi
20 |java.util.Collections.asLifoQueue(Deque<T>)|Returns a view of aDequeas a Last-
21 |java.util.Collections.binarySearch(List<?extendsComparable<?superT>>,T)|Search
22 |java.util.Collections.binarySearch(List<?extendsT>,T,Comparator<?superT>)|Sear
23 |java.util.Collections.checkedCollection(Collection<E>,Class<E>)|Returns a dyna
24 |java.util.Collections.checkedList(List<E>,Class<E>)|Returns a dynamically type
25 |java.util.Collections.checkedMap(Map<K,V>,Class<K>,Class<V>)|Returns a dynamic
26 |java.util.Collections.checkedSet(Set<E>,Class<E>)|Returns a dynamically typesa
27 |java.util.Collections.checkedSortedMap(SortedMap<K,V>,Class<K>,Class<V>)|Retur
28 |java.util.Collections.checkedSortedSet(SortedSet<E>,Class<E>)|Returns a dynami
29 |java.util.Collections.copy(List<?superT>,List<?extendsT>)|Copies all of the el
30 |java.util.Collections.disjoint(Collection<?>,Collection<?>)|Returns true if th
31 |java.util.Collections.emptyList()|Returns the empty list (immutable).
32 |java.util.Collections.emptyMap()|Returns the empty map (immutable).
33 |java.util.Collections.emptySet()|Returns the empty set (immutable).
34 |java.util.Collections.enumeration(Collection<T>)|Returns an enumeration over t
35 |java.util.Collections.fill(List<?superT>,T)|Replaces all of the elements of th
36 |java.util.Collections.frequency(Collection<?>,Object)|Returns the number of el
37 |java.util.Collections.indexOfSubList(List<?>,List<?>)|Returns the starting pos
38 |java.util.Collections.lastIndexOfSubList(List<?>,List<?>)|Returns the starting
39 |java.util.Collections.list(Enumeration<T>)|Returns an array list containing th
40 |java.util.Collections.max(Collection<?extendsT>)|Returns the maximum element o
41 |java.util.Collections.max(Collection<?extendsT>,Comparator<?superT>)|Returns t
42 |java.util.Collections.min(Collection<?extendsT>)|Returns the minimum element o
43 |java.util.Collections.min(Collection<?extendsT>,Comparator<?superT>)|Returns t
44 |java.util.Collections.nCopies(int,T)|Returns an immutable list consisting of n
45 |java.util.Collections.newSetFromMap(Map<E,Boolean>)|Returns a set backed by th
46 |java.util.Collections.replaceAll(List<T>,T,T)|Replaces all occurrences of one 
47 |java.util.Collections.reverse(List<?>)|Reverses the order of the elements in t
48 |java.util.Collections.reverseOrder()|Returns a comparator that imposes the rev
49 |java.util.Collections.reverseOrder(Comparator<T>)|Returns a comparator that im
50 |java.util.Collections.rotate(List<?>,int)|Rotates the elements in the specifie
51 |java.util.Collections.shuffle(List<?>)|Randomly permutes the specified list us
52 |java.util.Collections.shuffle(List<?>,Random)|Randomly permute the specified l
53 |java.util.Collections.singleton(T)|Returns an immutable set containing only th
54 |java.util.Collections.singletonList(T)|Returns an immutable list containing on
55 |java.util.Collections.singletonMap(K,V)|Returns an immutable map, mapping only
56 |java.util.Collections.sort(List<T>)|Sorts the specified list into ascending or
57 |java.util.Collections.sort(List<T>,Comparator<?superT>)|Sorts the specified li
58 |java.util.Collections.swap(List<?>,int,int)|Swaps the elements at the specifie
59 |java.util.Collections.synchronizedCollection(Collection<T>)|Returns a synchron
60 |java.util.Collections.synchronizedList(List<T>)|Returns a synchronized (thread
61 |java.util.Collections.synchronizedMap(Map<K,V>)|Returns a synchronized (thread
62 |java.util.Collections.synchronizedSet(Set<T>)|Returns a synchronized (thread-s
63 |java.util.Collections.synchronizedSortedMap(SortedMap<K,V>)|Returns a synchron
64 |java.util.Collections.synchronizedSortedSet(SortedSet<T>)|Returns a synchroniz
65 |java.util.Collections.unmodifiableCollection(Collection<?extendsT>)|Returns an
66 |java.util.Collections.unmodifiableList(List<?extendsT>)|Returns an unmodifiabl
67 |java.util.Collections.unmodifiableMap(Map<?extendsK,?extendsV>)|Returns an unm
68 |java.util.Collections.unmodifiableSet(Set<?extendsT>)|Returns an unmodifiable 
69 |java.util.Collections.unmodifiableSortedMap(SortedMap<K,?extendsV>)|Returns an
70 |java.util.Collections.unmodifiableSortedSet(SortedSet<T>)|Returns an unmodifia
72 *java.util.Collections_Description*
74 This class consists exclusively of static methods that operate on or return 
75 collections. It contains polymorphic algorithms that operate on collections, 
76 "wrappers", which return a new collection backed by a specified collection, and 
77 a few other odds and ends. 
79 The methods of this class all throw a NullPointerException if the collections 
80 or class objects provided to them are null. 
82 The documentation for the polymorphic algorithms contained in this class 
83 generally includes a brief description of the implementation. Such descriptions 
84 should be regarded as implementation notes, rather than parts of the 
85 specification. Implementors should feel free to substitute other algorithms, so 
86 long as the specification itself is adhered to. (For example, the algorithm 
87 used by sort does not have to be a mergesort, but it does have to be stable.) 
89 The "destructive" algorithms contained in this class, that is, the algorithms 
90 that modify the collection on which they operate, are specified to throw 
91 UnsupportedOperationException if the collection does not support the 
92 appropriate mutation primitive(s), such as the set method. These algorithms 
93 may, but are not required to, throw this exception if an invocation would have 
94 no effect on the collection. For example, invoking the sort method on an 
95 unmodifiable list that is already sorted may or may not throw 
96 UnsupportedOperationException. 
98 This class is a member of the <a 
99 href="/../technotes/guides/collections/index.html"> Java Collections Framework. 
103 *java.util.List_java.util.Collections.EMPTY_LIST*
105 The empty list (immutable). This list is serializable. 
108 *java.util.Map_java.util.Collections.EMPTY_MAP*
110 The empty map (immutable). This map is serializable. 
113 *java.util.Set_java.util.Collections.EMPTY_SET*
115 The empty set (immutable). This set is serializable. 
119 *java.util.Collections.addAll(Collection<?superT>,T...)*
121 public static boolean addAll(
122   java.util.Collection<? super T> c,
123   T[] elements)
125 Adds all of the specified elements to the specified collection. Elements to be 
126 added may be specified individually or as an array. The behavior of this 
127 convenience method is identical to that of c.addAll(Arrays.asList(elements)), 
128 but this method is likely to run significantly faster under most 
129 implementations. 
131 When elements are specified individually, this method provides a convenient way 
132 to add a few elements to an existing collection: 
134 Collections.addAll(flavors, "Peaches 'n Plutonium", "Rocky Racoon"); 
137     c - the collection into which elements are to be inserted 
138     elements - the elements to insert into c 
140     Returns: true if the collection changed as a result of the call 
142 *java.util.Collections.asLifoQueue(Deque<T>)*
144 public static |java.util.Queue|<T> asLifoQueue(java.util.Deque<T> deque)
146 Returns a view of a (|java.util.Deque|) as a Last-in-first-out (Lifo) 
147 (|java.util.Queue|) . Method add is mapped to push, remove is mapped to pop and 
148 so on. This view can be useful when you would like to use a method requiring a 
149 Queue but you need Lifo ordering. 
151 Each method invocation on the queue returned by this method results in exactly 
152 one method invocation on the backing deque, with one exception. The 
153 addAll(|java.util.Queue|) method is implemented as a sequence of 
154 addFirst(|java.util.Deque|) invocations on the backing deque. 
157     deque - the deque 
159     Returns: 
161 *java.util.Collections.binarySearch(List<?extendsComparable<?superT>>,T)*
163 public static int binarySearch(
164   java.util.List<? extends java.lang.Comparable<? super T>> list,
165   T key)
167 Searches the specified list for the specified object using the binary search 
168 algorithm. The list must be sorted into ascending order according to the 
169 natural ordering(|java.lang.Comparable|) of its elements (as by the 
170 (|java.util.Collections|) method) prior to making this call. If it is not 
171 sorted, the results are undefined. If the list contains multiple elements equal 
172 to the specified object, there is no guarantee which one will be found. 
174 This method runs in log(n) time for a "random access" list (which provides 
175 near-constant-time positional access). If the specified list does not implement 
176 the (|java.util.RandomAccess|) interface and is large, this method will do an 
177 iterator-based binary search that performs O(n) link traversals and O(log n) 
178 element comparisons. 
181     list - the list to be searched. 
182     key - the key to be searched for. 
184     Returns: the index of the search key, if it is contained in the list; otherwise, 
185              (-(insertion point) - 1). The insertion point is defined as the 
186              point at which the key would be inserted into the list: the index 
187              of the first element greater than the key, or list.size() if all 
188              elements in the list are less than the specified key. Note that 
189              this guarantees that the return value will be >= 0 if and only if 
190              the key is found. 
192 *java.util.Collections.binarySearch(List<?extendsT>,T,Comparator<?superT>)*
194 public static int binarySearch(
195   java.util.List<? extends T> list,
196   T key,
197   java.util.Comparator<? super T> c)
199 Searches the specified list for the specified object using the binary search 
200 algorithm. The list must be sorted into ascending order according to the 
201 specified comparator (as by the sort(List, Comparator)(|java.util.Collections|) 
202 method), prior to making this call. If it is not sorted, the results are 
203 undefined. If the list contains multiple elements equal to the specified 
204 object, there is no guarantee which one will be found. 
206 This method runs in log(n) time for a "random access" list (which provides 
207 near-constant-time positional access). If the specified list does not implement 
208 the (|java.util.RandomAccess|) interface and is large, this method will do an 
209 iterator-based binary search that performs O(n) link traversals and O(log n) 
210 element comparisons. 
213     list - the list to be searched. 
214     key - the key to be searched for. 
215     c - the comparator by which the list is ordered. A null value indicates that the 
216        elements' {@linkplain Comparable natural ordering} should be used. 
218     Returns: the index of the search key, if it is contained in the list; otherwise, 
219              (-(insertion point) - 1). The insertion point is defined as the 
220              point at which the key would be inserted into the list: the index 
221              of the first element greater than the key, or list.size() if all 
222              elements in the list are less than the specified key. Note that 
223              this guarantees that the return value will be >= 0 if and only if 
224              the key is found. 
226 *java.util.Collections.checkedCollection(Collection<E>,Class<E>)*
228 public static |java.util.Collection|<E> checkedCollection(
229   java.util.Collection<E> c,
230   java.lang.Class<E> type)
232 Returns a dynamically typesafe view of the specified collection. Any attempt to 
233 insert an element of the wrong type will result in an immediate 
234 ClassCastException. Assuming a collection contains no incorrectly typed 
235 elements prior to the time a dynamically typesafe view is generated, and that 
236 all subsequent access to the collection takes place through the view, it is 
237 guaranteed that the collection cannot contain an incorrectly typed element. 
239 The generics mechanism in the language provides compile-time (static) type 
240 checking, but it is possible to defeat this mechanism with unchecked casts. 
241 Usually this is not a problem, as the compiler issues warnings on all such 
242 unchecked operations. There are, however, times when static type checking alone 
243 is not sufficient. For example, suppose a collection is passed to a third-party 
244 library and it is imperative that the library code not corrupt the collection 
245 by inserting an element of the wrong type. 
247 Another use of dynamically typesafe views is debugging. Suppose a program fails 
248 with a ClassCastException, indicating that an incorrectly typed element was put 
249 into a parameterized collection. Unfortunately, the exception can occur at any 
250 time after the erroneous element is inserted, so it typically provides little 
251 or no information as to the real source of the problem. If the problem is 
252 reproducible, one can quickly determine its source by temporarily modifying the 
253 program to wrap the collection with a dynamically typesafe view. For example, 
254 this declaration: 
256 Collection<String> c = new HashSet<String>(); 
258 may be replaced temporarily by this one: 
260 Collection<String> c = Collections.checkedCollection( new HashSet<String>(), 
261 String.class); 
263 Running the program again will cause it to fail at the point where an 
264 incorrectly typed element is inserted into the collection, clearly identifying 
265 the source of the problem. Once the problem is fixed, the modified declaration 
266 may be reverted back to the original. 
268 The returned collection does not pass the hashCode and equals operations 
269 through to the backing collection, but relies on Object's equals and hashCode 
270 methods. This is necessary to preserve the contracts of these operations in the 
271 case that the backing collection is a set or a list. 
273 The returned collection will be serializable if the specified collection is 
274 serializable. 
277     c - the collection for which a dynamically typesafe view is to be returned 
278     type - the type of element that c is permitted to hold 
280     Returns: a dynamically typesafe view of the specified collection 
282 *java.util.Collections.checkedList(List<E>,Class<E>)*
284 public static |java.util.List|<E> checkedList(
285   java.util.List<E> list,
286   java.lang.Class<E> type)
288 Returns a dynamically typesafe view of the specified list. Any attempt to 
289 insert an element of the wrong type will result in an immediate 
290 ClassCastException. Assuming a list contains no incorrectly typed elements 
291 prior to the time a dynamically typesafe view is generated, and that all 
292 subsequent access to the list takes place through the view, it is guaranteed 
293 that the list cannot contain an incorrectly typed element. 
295 A discussion of the use of dynamically typesafe views may be found in the 
296 documentation for the checkedCollection(|java.util.Collections|) method. 
298 The returned list will be serializable if the specified list is serializable. 
301     list - the list for which a dynamically typesafe view is to be returned 
302     type - the type of element that list is permitted to hold 
304     Returns: a dynamically typesafe view of the specified list 
306 *java.util.Collections.checkedMap(Map<K,V>,Class<K>,Class<V>)*
308 public static |java.util.Map|<K,V> checkedMap(
309   java.util.Map<K, V> m,
310   java.lang.Class<K> keyType,
311   java.lang.Class<V> valueType)
313 Returns a dynamically typesafe view of the specified map. Any attempt to insert 
314 a mapping whose key or value have the wrong type will result in an immediate 
315 ClassCastException. Similarly, any attempt to modify the value currently 
316 associated with a key will result in an immediate ClassCastException, whether 
317 the modification is attempted directly through the map itself, or through a 
318 (|java.util.Map.Entry|) instance obtained from the map's entry 
319 set(|java.util.Map|) view. 
321 Assuming a map contains no incorrectly typed keys or values prior to the time a 
322 dynamically typesafe view is generated, and that all subsequent access to the 
323 map takes place through the view (or one of its collection views), it is 
324 guaranteed that the map cannot contain an incorrectly typed key or value. 
326 A discussion of the use of dynamically typesafe views may be found in the 
327 documentation for the checkedCollection(|java.util.Collections|) method. 
329 The returned map will be serializable if the specified map is serializable. 
332     m - the map for which a dynamically typesafe view is to be returned 
333     keyType - the type of key that m is permitted to hold 
334     valueType - the type of value that m is permitted to hold 
336     Returns: a dynamically typesafe view of the specified map 
338 *java.util.Collections.checkedSet(Set<E>,Class<E>)*
340 public static |java.util.Set|<E> checkedSet(
341   java.util.Set<E> s,
342   java.lang.Class<E> type)
344 Returns a dynamically typesafe view of the specified set. Any attempt to insert 
345 an element of the wrong type will result in an immediate ClassCastException. 
346 Assuming a set contains no incorrectly typed elements prior to the time a 
347 dynamically typesafe view is generated, and that all subsequent access to the 
348 set takes place through the view, it is guaranteed that the set cannot contain 
349 an incorrectly typed element. 
351 A discussion of the use of dynamically typesafe views may be found in the 
352 documentation for the checkedCollection(|java.util.Collections|) method. 
354 The returned set will be serializable if the specified set is serializable. 
357     s - the set for which a dynamically typesafe view is to be returned 
358     type - the type of element that s is permitted to hold 
360     Returns: a dynamically typesafe view of the specified set 
362 *java.util.Collections.checkedSortedMap(SortedMap<K,V>,Class<K>,Class<V>)*
364 public static |java.util.SortedMap|<K,V> checkedSortedMap(
365   java.util.SortedMap<K, V> m,
366   java.lang.Class<K> keyType,
367   java.lang.Class<V> valueType)
369 Returns a dynamically typesafe view of the specified sorted map. Any attempt to 
370 insert a mapping whose key or value have the wrong type will result in an 
371 immediate ClassCastException. Similarly, any attempt to modify the value 
372 currently associated with a key will result in an immediate ClassCastException, 
373 whether the modification is attempted directly through the map itself, or 
374 through a (|java.util.Map.Entry|) instance obtained from the map's entry 
375 set(|java.util.Map|) view. 
377 Assuming a map contains no incorrectly typed keys or values prior to the time a 
378 dynamically typesafe view is generated, and that all subsequent access to the 
379 map takes place through the view (or one of its collection views), it is 
380 guaranteed that the map cannot contain an incorrectly typed key or value. 
382 A discussion of the use of dynamically typesafe views may be found in the 
383 documentation for the checkedCollection(|java.util.Collections|) method. 
385 The returned map will be serializable if the specified map is serializable. 
388     m - the map for which a dynamically typesafe view is to be returned 
389     keyType - the type of key that m is permitted to hold 
390     valueType - the type of value that m is permitted to hold 
392     Returns: a dynamically typesafe view of the specified map 
394 *java.util.Collections.checkedSortedSet(SortedSet<E>,Class<E>)*
396 public static |java.util.SortedSet|<E> checkedSortedSet(
397   java.util.SortedSet<E> s,
398   java.lang.Class<E> type)
400 Returns a dynamically typesafe view of the specified sorted set. Any attempt to 
401 insert an element of the wrong type will result in an immediate 
402 ClassCastException. Assuming a sorted set contains no incorrectly typed 
403 elements prior to the time a dynamically typesafe view is generated, and that 
404 all subsequent access to the sorted set takes place through the view, it is 
405 guaranteed that the sorted set cannot contain an incorrectly typed element. 
407 A discussion of the use of dynamically typesafe views may be found in the 
408 documentation for the checkedCollection(|java.util.Collections|) method. 
410 The returned sorted set will be serializable if the specified sorted set is 
411 serializable. 
414     s - the sorted set for which a dynamically typesafe view is to be returned 
415     type - the type of element that s is permitted to hold 
417     Returns: a dynamically typesafe view of the specified sorted set 
419 *java.util.Collections.copy(List<?superT>,List<?extendsT>)*
421 public static void copy(
422   java.util.List<? super T> dest,
423   java.util.List<? extends T> src)
425 Copies all of the elements from one list into another. After the operation, the 
426 index of each copied element in the destination list will be identical to its 
427 index in the source list. The destination list must be at least as long as the 
428 source list. If it is longer, the remaining elements in the destination list 
429 are unaffected. 
431 This method runs in linear time. 
434     dest - The destination list. 
435     src - The source list. 
437 *java.util.Collections.disjoint(Collection<?>,Collection<?>)*
439 public static boolean disjoint(
440   java.util.Collection<?> c1,
441   java.util.Collection<?> c2)
443 Returns true if the two specified collections have no elements in common. 
445 Care must be exercised if this method is used on collections that do not comply 
446 with the general contract for Collection. Implementations may elect to iterate 
447 over either collection and test for containment in the other collection (or to 
448 perform any equivalent computation). If either collection uses a nonstandard 
449 equality test (as does a (|java.util.SortedSet|) whose ordering is not 
450 compatible with equals, or the key set of an (|java.util.IdentityHashMap|) ), 
451 both collections must use the same nonstandard equality test, or the result of 
452 this method is undefined. 
454 Note that it is permissible to pass the same collection in both parameters, in 
455 which case the method will return true if and only if the collection is empty. 
458     c1 - a collection 
459     c2 - a collection 
461 *java.util.Collections.emptyList()*
463 public static final |java.util.List|<T> emptyList()
465 Returns the empty list (immutable). This list is serializable. 
467 This example illustrates the type-safe way to obtain an empty list: 
469 List<String> s = Collections.emptyList(); 
471 Implementation note: Implementations of this method need not create a separate 
472 List object for each call. Using this method is likely to have comparable cost 
473 to using the like-named field. (Unlike this method, the field does not provide 
474 type safety.) 
478 *java.util.Collections.emptyMap()*
480 public static final |java.util.Map|<K,V> emptyMap()
482 Returns the empty map (immutable). This map is serializable. 
484 This example illustrates the type-safe way to obtain an empty set: 
486 Map<String, Date> s = Collections.emptyMap(); 
488 Implementation note: Implementations of this method need not create a separate 
489 Map object for each call. Using this method is likely to have comparable cost 
490 to using the like-named field. (Unlike this method, the field does not provide 
491 type safety.) 
495 *java.util.Collections.emptySet()*
497 public static final |java.util.Set|<T> emptySet()
499 Returns the empty set (immutable). This set is serializable. Unlike the 
500 like-named field, this method is parameterized. 
502 This example illustrates the type-safe way to obtain an empty set: 
504 Set<String> s = Collections.emptySet(); 
506 Implementation note: Implementations of this method need not create a separate 
507 Set object for each call. Using this method is likely to have comparable cost 
508 to using the like-named field. (Unlike this method, the field does not provide 
509 type safety.) 
513 *java.util.Collections.enumeration(Collection<T>)*
515 public static |java.util.Enumeration|<T> enumeration(java.util.Collection<T> c)
517 Returns an enumeration over the specified collection. This provides 
518 interoperability with legacy APIs that require an enumeration as input. 
521     c - the collection for which an enumeration is to be returned. 
523     Returns: an enumeration over the specified collection. 
525 *java.util.Collections.fill(List<?superT>,T)*
527 public static void fill(
528   java.util.List<? super T> list,
529   T obj)
531 Replaces all of the elements of the specified list with the specified element. 
533 This method runs in linear time. 
536     list - the list to be filled with the specified element. 
537     obj - The element with which to fill the specified list. 
539 *java.util.Collections.frequency(Collection<?>,Object)*
541 public static int frequency(
542   java.util.Collection<?> c,
543   java.lang.Object o)
545 Returns the number of elements in the specified collection equal to the 
546 specified object. More formally, returns the number of elements e in the 
547 collection such that (o == null ? e == null : o.equals(e)). 
550     c - the collection in which to determine the frequency of o 
551     o - the object whose frequency is to be determined 
553 *java.util.Collections.indexOfSubList(List<?>,List<?>)*
555 public static int indexOfSubList(
556   java.util.List<?> source,
557   java.util.List<?> target)
559 Returns the starting position of the first occurrence of the specified target 
560 list within the specified source list, or -1 if there is no such occurrence. 
561 More formally, returns the lowest index i such that source.subList(i, 
562 i+target.size()).equals(target), or -1 if there is no such index. (Returns -1 
563 if target.size() > source.size().) 
565 This implementation uses the "brute force" technique of scanning over the 
566 source list, looking for a match with the target at each location in turn. 
569     source - the list in which to search for the first occurrence of target. 
570     target - the list to search for as a subList of source. 
572     Returns: the starting position of the first occurrence of the specified target list 
573              within the specified source list, or -1 if there is no such 
574              occurrence. 
576 *java.util.Collections.lastIndexOfSubList(List<?>,List<?>)*
578 public static int lastIndexOfSubList(
579   java.util.List<?> source,
580   java.util.List<?> target)
582 Returns the starting position of the last occurrence of the specified target 
583 list within the specified source list, or -1 if there is no such occurrence. 
584 More formally, returns the highest index i such that source.subList(i, 
585 i+target.size()).equals(target), or -1 if there is no such index. (Returns -1 
586 if target.size() > source.size().) 
588 This implementation uses the "brute force" technique of iterating over the 
589 source list, looking for a match with the target at each location in turn. 
592     source - the list in which to search for the last occurrence of target. 
593     target - the list to search for as a subList of source. 
595     Returns: the starting position of the last occurrence of the specified target list 
596              within the specified source list, or -1 if there is no such 
597              occurrence. 
599 *java.util.Collections.list(Enumeration<T>)*
601 public static |java.util.ArrayList|<T> list(java.util.Enumeration<T> e)
603 Returns an array list containing the elements returned by the specified 
604 enumeration in the order they are returned by the enumeration. This method 
605 provides interoperability between legacy APIs that return enumerations and new 
606 APIs that require collections. 
609     e - enumeration providing elements for the returned array list 
611     Returns: an array list containing the elements returned by the specified enumeration. 
613 *java.util.Collections.max(Collection<?extendsT>)*
615 public static |T| max(java.util.Collection<? extends T> coll)
617 Returns the maximum element of the given collection, according to the natural 
618 ordering of its elements. All elements in the collection must implement the 
619 Comparable interface. Furthermore, all elements in the collection must be 
620 mutually comparable (that is, e1.compareTo(e2) must not throw a 
621 ClassCastException for any elements e1 and e2 in the collection). 
623 This method iterates over the entire collection, hence it requires time 
624 proportional to the size of the collection. 
627     coll - the collection whose maximum element is to be determined. 
629     Returns: the maximum element of the given collection, according to the natural ordering 
630              of its elements. 
632 *java.util.Collections.max(Collection<?extendsT>,Comparator<?superT>)*
634 public static |T| max(
635   java.util.Collection<? extends T> coll,
636   java.util.Comparator<? super T> comp)
638 Returns the maximum element of the given collection, according to the order 
639 induced by the specified comparator. All elements in the collection must be 
640 mutually comparable by the specified comparator (that is, comp.compare(e1, e2) 
641 must not throw a ClassCastException for any elements e1 and e2 in the 
642 collection). 
644 This method iterates over the entire collection, hence it requires time 
645 proportional to the size of the collection. 
648     coll - the collection whose maximum element is to be determined. 
649     comp - the comparator with which to determine the maximum element. A null value 
650        indicates that the elements' natural ordering should be used. 
652     Returns: the maximum element of the given collection, according to the specified 
653              comparator. 
655 *java.util.Collections.min(Collection<?extendsT>)*
657 public static |T| min(java.util.Collection<? extends T> coll)
659 Returns the minimum element of the given collection, according to the natural 
660 ordering of its elements. All elements in the collection must implement the 
661 Comparable interface. Furthermore, all elements in the collection must be 
662 mutually comparable (that is, e1.compareTo(e2) must not throw a 
663 ClassCastException for any elements e1 and e2 in the collection). 
665 This method iterates over the entire collection, hence it requires time 
666 proportional to the size of the collection. 
669     coll - the collection whose minimum element is to be determined. 
671     Returns: the minimum element of the given collection, according to the natural ordering 
672              of its elements. 
674 *java.util.Collections.min(Collection<?extendsT>,Comparator<?superT>)*
676 public static |T| min(
677   java.util.Collection<? extends T> coll,
678   java.util.Comparator<? super T> comp)
680 Returns the minimum element of the given collection, according to the order 
681 induced by the specified comparator. All elements in the collection must be 
682 mutually comparable by the specified comparator (that is, comp.compare(e1, e2) 
683 must not throw a ClassCastException for any elements e1 and e2 in the 
684 collection). 
686 This method iterates over the entire collection, hence it requires time 
687 proportional to the size of the collection. 
690     coll - the collection whose minimum element is to be determined. 
691     comp - the comparator with which to determine the minimum element. A null value 
692        indicates that the elements' natural ordering should be used. 
694     Returns: the minimum element of the given collection, according to the specified 
695              comparator. 
697 *java.util.Collections.nCopies(int,T)*
699 public static |java.util.List|<T> nCopies(
700   int n,
701   T o)
703 Returns an immutable list consisting of n copies of the specified object. The 
704 newly allocated data object is tiny (it contains a single reference to the data 
705 object). This method is useful in combination with the List.addAll method to 
706 grow lists. The returned list is serializable. 
709     n - the number of elements in the returned list. 
710     o - the element to appear repeatedly in the returned list. 
712     Returns: an immutable list consisting of n copies of the specified object. 
714 *java.util.Collections.newSetFromMap(Map<E,Boolean>)*
716 public static |java.util.Set|<E> newSetFromMap(java.util.Map<E, java.lang.Boolean> map)
718 Returns a set backed by the specified map. The resulting set displays the same 
719 ordering, concurrency, and performance characteristics as the backing map. In 
720 essence, this factory method provides a (|java.util.Set|) implementation 
721 corresponding to any (|java.util.Map|) implementation. There is no need to use 
722 this method on a (|java.util.Map|) implementation that already has a 
723 corresponding (|java.util.Set|) implementation (such as (|java.util.HashMap|) 
724 or (|java.util.TreeMap|) ). 
726 Each method invocation on the set returned by this method results in exactly 
727 one method invocation on the backing map or its keySet view, with one 
728 exception. The addAll method is implemented as a sequence of put invocations on 
729 the backing map. 
731 The specified map must be empty at the time this method is invoked, and should 
732 not be accessed directly after this method returns. These conditions are 
733 ensured if the map is created empty, passed directly to this method, and no 
734 reference to the map is retained, as illustrated in the following code 
735 fragment: 
737 Set<Object> weakHashSet = Collections.newSetFromMap( new WeakHashMap<Object, 
738 Boolean>()); 
741     map - the backing map 
743     Returns: the set backed by the map 
745 *java.util.Collections.replaceAll(List<T>,T,T)*
747 public static boolean replaceAll(
748   java.util.List<T> list,
749   T oldVal,
750   T newVal)
752 Replaces all occurrences of one specified value in a list with another. More 
753 formally, replaces with newVal each element e in list such that (oldVal==null ? 
754 e==null : oldVal.equals(e)). (This method has no effect on the size of the 
755 list.) 
758     list - the list in which replacement is to occur. 
759     oldVal - the old value to be replaced. 
760     newVal - the new value with which oldVal is to be replaced. 
762     Returns: true if list contained one or more elements e such that (oldVal==null ? e==null 
763              : oldVal.equals(e)). 
765 *java.util.Collections.reverse(List<?>)*
767 public static void reverse(java.util.List<?> list)
769 Reverses the order of the elements in the specified list. 
771 This method runs in linear time. 
774     list - the list whose elements are to be reversed. 
776 *java.util.Collections.reverseOrder()*
778 public static |java.util.Comparator|<T> reverseOrder()
780 Returns a comparator that imposes the reverse of the natural ordering on a 
781 collection of objects that implement the Comparable interface. (The natural 
782 ordering is the ordering imposed by the objects' own compareTo method.) This 
783 enables a simple idiom for sorting (or maintaining) collections (or arrays) of 
784 objects that implement the Comparable interface in reverse-natural-order. For 
785 example, suppose a is an array of strings. Then: 
787 Arrays.sort(a, Collections.reverseOrder()); 
789 sorts the array in reverse-lexicographic (alphabetical) order. 
791 The returned comparator is serializable. 
795     Returns: a comparator that imposes the reverse of the natural ordering on a collection 
796              of objects that implement the Comparable interface. 
798 *java.util.Collections.reverseOrder(Comparator<T>)*
800 public static |java.util.Comparator|<T> reverseOrder(java.util.Comparator<T> cmp)
802 Returns a comparator that imposes the reverse ordering of the specified 
803 comparator. If the specified comparator is null, this method is equivalent to 
804 (|java.util.Collections|) (in other words, it returns a comparator that imposes 
805 the reverse of the natural ordering on a collection of objects that implement 
806 the Comparable interface). 
808 The returned comparator is serializable (assuming the specified comparator is 
809 also serializable or null). 
813     Returns: a comparator that imposes the reverse ordering of the specified comparator. 
815 *java.util.Collections.rotate(List<?>,int)*
817 public static void rotate(
818   java.util.List<?> list,
819   int distance)
821 Rotates the elements in the specified list by the specified distance. After 
822 calling this method, the element at index i will be the element previously at 
823 index (i - distance) mod list.size(), for all values of i between 0 and 
824 list.size()-1, inclusive. (This method has no effect on the size of the list.) 
826 For example, suppose list comprises [t, a, n, k, s]. After invoking 
827 Collections.rotate(list, 1) (or Collections.rotate(list, -4)), list will 
828 comprise [s, t, a, n, k]. 
830 Note that this method can usefully be applied to sublists to move one or more 
831 elements within a list while preserving the order of the remaining elements. 
832 For example, the following idiom moves the element at index j forward to 
833 position k (which must be greater than or equal to j): 
835 Collections.rotate(list.subList(j, k+1), -1); 
837 To make this concrete, suppose list comprises [a, b, c, d, e]. To move the 
838 element at index 1 (b) forward two positions, perform the following invocation: 
840 Collections.rotate(l.subList(1, 4), -1); 
842 The resulting list is [a, c, d, b, e]. 
844 To move more than one element forward, increase the absolute value of the 
845 rotation distance. To move elements backward, use a positive shift distance. 
847 If the specified list is small or implements the (|java.util.RandomAccess|) 
848 interface, this implementation exchanges the first element into the location it 
849 should go, and then repeatedly exchanges the displaced element into the 
850 location it should go until a displaced element is swapped into the first 
851 element. If necessary, the process is repeated on the second and successive 
852 elements, until the rotation is complete. If the specified list is large and 
853 doesn't implement the RandomAccess interface, this implementation breaks the 
854 list into two sublist views around index -distance mod size. Then the 
855 (|java.util.Collections|) method is invoked on each sublist view, and finally 
856 it is invoked on the entire list. For a more complete description of both 
857 algorithms, see Section 2.3 of Jon Bentley's Programming Pearls 
858 (Addison-Wesley, 1986). 
861     list - the list to be rotated. 
862     distance - the distance to rotate the list. There are no constraints on this value; it may 
863        be zero, negative, or greater than list.size(). 
865 *java.util.Collections.shuffle(List<?>)*
867 public static void shuffle(java.util.List<?> list)
869 Randomly permutes the specified list using a default source of randomness. All 
870 permutations occur with approximately equal likelihood. 
872 The hedge "approximately" is used in the foregoing description because default 
873 source of randomness is only approximately an unbiased source of independently 
874 chosen bits. If it were a perfect source of randomly chosen bits, then the 
875 algorithm would choose permutations with perfect uniformity. 
877 This implementation traverses the list backwards, from the last element up to 
878 the second, repeatedly swapping a randomly selected element into the "current 
879 position". Elements are randomly selected from the portion of the list that 
880 runs from the first element to the current position, inclusive. 
882 This method runs in linear time. If the specified list does not implement the 
883 (|java.util.RandomAccess|) interface and is large, this implementation dumps 
884 the specified list into an array before shuffling it, and dumps the shuffled 
885 array back into the list. This avoids the quadratic behavior that would result 
886 from shuffling a "sequential access" list in place. 
889     list - the list to be shuffled. 
891 *java.util.Collections.shuffle(List<?>,Random)*
893 public static void shuffle(
894   java.util.List<?> list,
895   java.util.Random rnd)
897 Randomly permute the specified list using the specified source of randomness. 
898 All permutations occur with equal likelihood assuming that the source of 
899 randomness is fair. 
901 This implementation traverses the list backwards, from the last element up to 
902 the second, repeatedly swapping a randomly selected element into the "current 
903 position". Elements are randomly selected from the portion of the list that 
904 runs from the first element to the current position, inclusive. 
906 This method runs in linear time. If the specified list does not implement the 
907 (|java.util.RandomAccess|) interface and is large, this implementation dumps 
908 the specified list into an array before shuffling it, and dumps the shuffled 
909 array back into the list. This avoids the quadratic behavior that would result 
910 from shuffling a "sequential access" list in place. 
913     list - the list to be shuffled. 
914     rnd - the source of randomness to use to shuffle the list. 
916 *java.util.Collections.singleton(T)*
918 public static |java.util.Set|<T> singleton(T o)
920 Returns an immutable set containing only the specified object. The returned set 
921 is serializable. 
924     o - the sole object to be stored in the returned set. 
926     Returns: an immutable set containing only the specified object. 
928 *java.util.Collections.singletonList(T)*
930 public static |java.util.List|<T> singletonList(T o)
932 Returns an immutable list containing only the specified object. The returned 
933 list is serializable. 
936     o - the sole object to be stored in the returned list. 
938     Returns: an immutable list containing only the specified object. 
940 *java.util.Collections.singletonMap(K,V)*
942 public static |java.util.Map|<K,V> singletonMap(
943   K key,
944   V value)
946 Returns an immutable map, mapping only the specified key to the specified 
947 value. The returned map is serializable. 
950     key - the sole key to be stored in the returned map. 
951     value - the value to which the returned map maps key. 
953     Returns: an immutable map containing only the specified key-value mapping. 
955 *java.util.Collections.sort(List<T>)*
957 public static void sort(java.util.List<T> list)
959 Sorts the specified list into ascending order, according to the natural 
960 ordering of its elements. All elements in the list must implement the 
961 Comparable interface. Furthermore, all elements in the list must be mutually 
962 comparable (that is, e1.compareTo(e2) must not throw a ClassCastException for 
963 any elements e1 and e2 in the list). 
965 This sort is guaranteed to be stable: equal elements will not be reordered as a 
966 result of the sort. 
968 The specified list must be modifiable, but need not be resizable. 
970 The sorting algorithm is a modified mergesort (in which the merge is omitted if 
971 the highest element in the low sublist is less than the lowest element in the 
972 high sublist). This algorithm offers guaranteed n log(n) performance. 
974 This implementation dumps the specified list into an array, sorts the array, 
975 and iterates over the list resetting each element from the corresponding 
976 position in the array. This avoids the n2 log(n) performance that would result 
977 from attempting to sort a linked list in place. 
980     list - the list to be sorted. 
982 *java.util.Collections.sort(List<T>,Comparator<?superT>)*
984 public static void sort(
985   java.util.List<T> list,
986   java.util.Comparator<? super T> c)
988 Sorts the specified list according to the order induced by the specified 
989 comparator. All elements in the list must be mutually comparable using the 
990 specified comparator (that is, c.compare(e1, e2) must not throw a 
991 ClassCastException for any elements e1 and e2 in the list). 
993 This sort is guaranteed to be stable: equal elements will not be reordered as a 
994 result of the sort. 
996 The sorting algorithm is a modified mergesort (in which the merge is omitted if 
997 the highest element in the low sublist is less than the lowest element in the 
998 high sublist). This algorithm offers guaranteed n log(n) performance. 
1000 The specified list must be modifiable, but need not be resizable. This 
1001 implementation dumps the specified list into an array, sorts the array, and 
1002 iterates over the list resetting each element from the corresponding position 
1003 in the array. This avoids the n2 log(n) performance that would result from 
1004 attempting to sort a linked list in place. 
1007     list - the list to be sorted. 
1008     c - the comparator to determine the order of the list. A null value indicates that 
1009        the elements' natural ordering should be used. 
1011 *java.util.Collections.swap(List<?>,int,int)*
1013 public static void swap(
1014   java.util.List<?> list,
1015   int i,
1016   int j)
1018 Swaps the elements at the specified positions in the specified list. (If the 
1019 specified positions are equal, invoking this method leaves the list unchanged.) 
1022     list - The list in which to swap elements. 
1023     i - the index of one element to be swapped. 
1024     j - the index of the other element to be swapped. 
1026 *java.util.Collections.synchronizedCollection(Collection<T>)*
1028 public static |java.util.Collection|<T> synchronizedCollection(java.util.Collection<T> c)
1030 Returns a synchronized (thread-safe) collection backed by the specified 
1031 collection. In order to guarantee serial access, it is critical that all access 
1032 to the backing collection is accomplished through the returned collection. 
1034 It is imperative that the user manually synchronize on the returned collection 
1035 when iterating over it: 
1037 Collection c = Collections.synchronizedCollection(myCollection); ... 
1038 synchronized(c) { Iterator i = c.iterator(); // Must be in the synchronized 
1039 block while (i.hasNext()) foo(i.next()); } 
1041 Failure to follow this advice may result in non-deterministic behavior. 
1043 The returned collection does not pass the hashCode and equals operations 
1044 through to the backing collection, but relies on Object's equals and hashCode 
1045 methods. This is necessary to preserve the contracts of these operations in the 
1046 case that the backing collection is a set or a list. 
1048 The returned collection will be serializable if the specified collection is 
1049 serializable. 
1052     c - the collection to be "wrapped" in a synchronized collection. 
1054     Returns: a synchronized view of the specified collection. 
1056 *java.util.Collections.synchronizedList(List<T>)*
1058 public static |java.util.List|<T> synchronizedList(java.util.List<T> list)
1060 Returns a synchronized (thread-safe) list backed by the specified list. In 
1061 order to guarantee serial access, it is critical that all access to the backing 
1062 list is accomplished through the returned list. 
1064 It is imperative that the user manually synchronize on the returned list when 
1065 iterating over it: 
1067 List list = Collections.synchronizedList(new ArrayList()); ... 
1068 synchronized(list) { Iterator i = list.iterator(); // Must be in synchronized 
1069 block while (i.hasNext()) foo(i.next()); } 
1071 Failure to follow this advice may result in non-deterministic behavior. 
1073 The returned list will be serializable if the specified list is serializable. 
1076     list - the list to be "wrapped" in a synchronized list. 
1078     Returns: a synchronized view of the specified list. 
1080 *java.util.Collections.synchronizedMap(Map<K,V>)*
1082 public static |java.util.Map|<K,V> synchronizedMap(java.util.Map<K, V> m)
1084 Returns a synchronized (thread-safe) map backed by the specified map. In order 
1085 to guarantee serial access, it is critical that all access to the backing map 
1086 is accomplished through the returned map. 
1088 It is imperative that the user manually synchronize on the returned map when 
1089 iterating over any of its collection views: 
1091 Map m = Collections.synchronizedMap(new HashMap()); ... Set s = m.keySet(); // 
1092 Needn't be in synchronized block ... synchronized(m) { // Synchronizing on m, 
1093 not s! Iterator i = s.iterator(); // Must be in synchronized block while 
1094 (i.hasNext()) foo(i.next()); } 
1096 Failure to follow this advice may result in non-deterministic behavior. 
1098 The returned map will be serializable if the specified map is serializable. 
1101     m - the map to be "wrapped" in a synchronized map. 
1103     Returns: a synchronized view of the specified map. 
1105 *java.util.Collections.synchronizedSet(Set<T>)*
1107 public static |java.util.Set|<T> synchronizedSet(java.util.Set<T> s)
1109 Returns a synchronized (thread-safe) set backed by the specified set. In order 
1110 to guarantee serial access, it is critical that all access to the backing set 
1111 is accomplished through the returned set. 
1113 It is imperative that the user manually synchronize on the returned set when 
1114 iterating over it: 
1116 Set s = Collections.synchronizedSet(new HashSet()); ... synchronized(s) { 
1117 Iterator i = s.iterator(); // Must be in the synchronized block while 
1118 (i.hasNext()) foo(i.next()); } 
1120 Failure to follow this advice may result in non-deterministic behavior. 
1122 The returned set will be serializable if the specified set is serializable. 
1125     s - the set to be "wrapped" in a synchronized set. 
1127     Returns: a synchronized view of the specified set. 
1129 *java.util.Collections.synchronizedSortedMap(SortedMap<K,V>)*
1131 public static |java.util.SortedMap|<K,V> synchronizedSortedMap(java.util.SortedMap<K, V> m)
1133 Returns a synchronized (thread-safe) sorted map backed by the specified sorted 
1134 map. In order to guarantee serial access, it is critical that all access to the 
1135 backing sorted map is accomplished through the returned sorted map (or its 
1136 views). 
1138 It is imperative that the user manually synchronize on the returned sorted map 
1139 when iterating over any of its collection views, or the collections views of 
1140 any of its subMap, headMap or tailMap views. 
1142 SortedMap m = Collections.synchronizedSortedMap(new TreeMap()); ... Set s = 
1143 m.keySet(); // Needn't be in synchronized block ... synchronized(m) { // 
1144 Synchronizing on m, not s! Iterator i = s.iterator(); // Must be in 
1145 synchronized block while (i.hasNext()) foo(i.next()); } 
1147 or: 
1149 SortedMap m = Collections.synchronizedSortedMap(new TreeMap()); SortedMap m2 = 
1150 m.subMap(foo, bar); ... Set s2 = m2.keySet(); // Needn't be in synchronized 
1151 block ... synchronized(m) { // Synchronizing on m, not m2 or s2! Iterator i = 
1152 s.iterator(); // Must be in synchronized block while (i.hasNext()) 
1153 foo(i.next()); } 
1155 Failure to follow this advice may result in non-deterministic behavior. 
1157 The returned sorted map will be serializable if the specified sorted map is 
1158 serializable. 
1161     m - the sorted map to be "wrapped" in a synchronized sorted map. 
1163     Returns: a synchronized view of the specified sorted map. 
1165 *java.util.Collections.synchronizedSortedSet(SortedSet<T>)*
1167 public static |java.util.SortedSet|<T> synchronizedSortedSet(java.util.SortedSet<T> s)
1169 Returns a synchronized (thread-safe) sorted set backed by the specified sorted 
1170 set. In order to guarantee serial access, it is critical that all access to the 
1171 backing sorted set is accomplished through the returned sorted set (or its 
1172 views). 
1174 It is imperative that the user manually synchronize on the returned sorted set 
1175 when iterating over it or any of its subSet, headSet, or tailSet views. 
1177 SortedSet s = Collections.synchronizedSortedSet(new TreeSet()); ... 
1178 synchronized(s) { Iterator i = s.iterator(); // Must be in the synchronized 
1179 block while (i.hasNext()) foo(i.next()); } 
1181 or: 
1183 SortedSet s = Collections.synchronizedSortedSet(new TreeSet()); SortedSet s2 = 
1184 s.headSet(foo); ... synchronized(s) { // Note: s, not s2!!! Iterator i = 
1185 s2.iterator(); // Must be in the synchronized block while (i.hasNext()) 
1186 foo(i.next()); } 
1188 Failure to follow this advice may result in non-deterministic behavior. 
1190 The returned sorted set will be serializable if the specified sorted set is 
1191 serializable. 
1194     s - the sorted set to be "wrapped" in a synchronized sorted set. 
1196     Returns: a synchronized view of the specified sorted set. 
1198 *java.util.Collections.unmodifiableCollection(Collection<?extendsT>)*
1200 public static |java.util.Collection|<T> unmodifiableCollection(java.util.Collection<? extends T> c)
1202 Returns an unmodifiable view of the specified collection. This method allows 
1203 modules to provide users with "read-only" access to internal collections. Query 
1204 operations on the returned collection "read through" to the specified 
1205 collection, and attempts to modify the returned collection, whether direct or 
1206 via its iterator, result in an UnsupportedOperationException. 
1208 The returned collection does not pass the hashCode and equals operations 
1209 through to the backing collection, but relies on Object's equals and hashCode 
1210 methods. This is necessary to preserve the contracts of these operations in the 
1211 case that the backing collection is a set or a list. 
1213 The returned collection will be serializable if the specified collection is 
1214 serializable. 
1217     c - the collection for which an unmodifiable view is to be returned. 
1219     Returns: an unmodifiable view of the specified collection. 
1221 *java.util.Collections.unmodifiableList(List<?extendsT>)*
1223 public static |java.util.List|<T> unmodifiableList(java.util.List<? extends T> list)
1225 Returns an unmodifiable view of the specified list. This method allows modules 
1226 to provide users with "read-only" access to internal lists. Query operations on 
1227 the returned list "read through" to the specified list, and attempts to modify 
1228 the returned list, whether direct or via its iterator, result in an 
1229 UnsupportedOperationException. 
1231 The returned list will be serializable if the specified list is serializable. 
1232 Similarly, the returned list will implement (|java.util.RandomAccess|) if the 
1233 specified list does. 
1236     list - the list for which an unmodifiable view is to be returned. 
1238     Returns: an unmodifiable view of the specified list. 
1240 *java.util.Collections.unmodifiableMap(Map<?extendsK,?extendsV>)*
1242 public static |java.util.Map|<K,V> unmodifiableMap(java.util.Map<? extends K, ? extends V> m)
1244 Returns an unmodifiable view of the specified map. This method allows modules 
1245 to provide users with "read-only" access to internal maps. Query operations on 
1246 the returned map "read through" to the specified map, and attempts to modify 
1247 the returned map, whether direct or via its collection views, result in an 
1248 UnsupportedOperationException. 
1250 The returned map will be serializable if the specified map is serializable. 
1253     m - the map for which an unmodifiable view is to be returned. 
1255     Returns: an unmodifiable view of the specified map. 
1257 *java.util.Collections.unmodifiableSet(Set<?extendsT>)*
1259 public static |java.util.Set|<T> unmodifiableSet(java.util.Set<? extends T> s)
1261 Returns an unmodifiable view of the specified set. This method allows modules 
1262 to provide users with "read-only" access to internal sets. Query operations on 
1263 the returned set "read through" to the specified set, and attempts to modify 
1264 the returned set, whether direct or via its iterator, result in an 
1265 UnsupportedOperationException. 
1267 The returned set will be serializable if the specified set is serializable. 
1270     s - the set for which an unmodifiable view is to be returned. 
1272     Returns: an unmodifiable view of the specified set. 
1274 *java.util.Collections.unmodifiableSortedMap(SortedMap<K,?extendsV>)*
1276 public static |java.util.SortedMap|<K,V> unmodifiableSortedMap(java.util.SortedMap<K, ? extends V> m)
1278 Returns an unmodifiable view of the specified sorted map. This method allows 
1279 modules to provide users with "read-only" access to internal sorted maps. Query 
1280 operations on the returned sorted map "read through" to the specified sorted 
1281 map. Attempts to modify the returned sorted map, whether direct, via its 
1282 collection views, or via its subMap, headMap, or tailMap views, result in an 
1283 UnsupportedOperationException. 
1285 The returned sorted map will be serializable if the specified sorted map is 
1286 serializable. 
1289     m - the sorted map for which an unmodifiable view is to be returned. 
1291     Returns: an unmodifiable view of the specified sorted map. 
1293 *java.util.Collections.unmodifiableSortedSet(SortedSet<T>)*
1295 public static |java.util.SortedSet|<T> unmodifiableSortedSet(java.util.SortedSet<T> s)
1297 Returns an unmodifiable view of the specified sorted set. This method allows 
1298 modules to provide users with "read-only" access to internal sorted sets. Query 
1299 operations on the returned sorted set "read through" to the specified sorted 
1300 set. Attempts to modify the returned sorted set, whether direct, via its 
1301 iterator, or via its subSet, headSet, or tailSet views, result in an 
1302 UnsupportedOperationException. 
1304 The returned sorted set will be serializable if the specified sorted set is 
1305 serializable. 
1308     s - the sorted set for which an unmodifiable view is to be returned. 
1310     Returns: an unmodifiable view of the specified sorted set.