Collections and Arrays are the same inorctiterative class that provides some static methods to operate Collection.
1. Sort Sortpublic Static Void Sort (List List) Public Static Void Sort (List List, Comparator C) is used to sort List, and natural sorting can also be specified, and the Comparator is specified, and the return is from a small to large ordered List.
2. Find binarysearchpublic static int binarysearch (list list, object key) public static int binarysearch (List List, Object Key, Comparator C) The List must be ordered, otherwise the change is no effect.
3. Reversing public static void reverse (list list) is suitable for LIST, returned LIST and the original order
4. Disators of the sequential static void shuffle (list list) public static void shuffle (list list, random rnd) is randomly messing the order of the original list.
5. Element directly replaces Public Static Void Swap (List List, Int i, Int J) This method is a bit awkward, I don't think there is no need to appear in the API, the implementation is a statement: list.set (i, list.set , List.get (i))))));
6. Plug public static void fix (list list, object obj) filled all the elements in the LIST
7. Copy Public Static Void Copy (List Dest, List SRC) Copy the source list to the destination List, the destination list must be large enough
8. Minimum PUBLIC Static Object Min (Collection Coll) Public Static Object Min (Collection Coll, Comparator Comp)
9. Maximum PUBLIC Static Object Max (Collection COLL) Public Static Object Max (Collection Coll, Comparator Comp)
10. Move the PUBLIC Static Void Rotate (List List, Int Distance) element right shift, a bit like Int a = 0xFF >> 8
11. Replace the public static boolean replacell (list list, object old, object newval)
12. Subproduction Listpublic Static int indexofsublist (list source, list target) public static int LastIndexOfSublist (List source, List target) and String class INDEXOF and LastIndexOf
13. A synchronous public static Collection synchronizedCollection (Collection c) public static List synchronizedList (List list) public static Map synchronizedMap (Map m) public static Set synchronizedSet (Set s) public static SortedMap synchronizedSortedMap (SortedMap m) public static SortedSet synchronizedSortedSet (SortedSet s Most of the classes in the Collection framework are not synchronized, you can use these methods to note that there is no use to overload because it is different. In addition, although returned is a synchronized Collection but still needs to synchronize itself when accessible through iterators, because the iterator returns is not synchronized. 14. A read-only public static Collection unmodifiableCollection (Collection c) public static List unmodifiableList (List list) public static Map unmodifiableMap (Map m) public static Set unmodifiableSet (Set s) public static SortedMap unmodifiableSortedMap (SortedMap m) public static SortedSet unmodifiableSortedSet (SortedSet s) These methods return a read-only Collection, I found this time really useful, if you try to call the modification method, you will get an unsupportedOperationException system exception.
15. Constant Public Static Final List Empty_List = New EmptyList () Public Static Final Map Empty_map = New EmptyMap () Public Static Final Set Empty_Set = New EmptySet () These constants is a collection of empty, it is not null, but does not contain any elements. .
16. Single Element Collection Public Static Set Singleton (Object O) Public Static List SingletonList (Object O) Public Static Map SingletonMap (Object Key, Object Value) These collections contain only one element.
17. Multi-elected collection Public Static List NCOPIES (INT N, OBJECT O) Returns a list, containing n identical elements
18. The comparator constant Public Static Comparator ReverseOrder () This comparator and natural sequence is reversed.
19. Conversion of the last 2 public static arraylist list (Final Collection C) List and Enumeration, due to the ENUMERATION that is an Oversiced API, there should be no chance to use them.
The entire method is here, mainly for the operation of the List, relatively few more SET and MAP.