1 Packagecollections_show;2 /*3 * Tool class for operation set collection collections4 * Description:5 Collections is a tool class that operates collections of set, List, and Map6 Collections provides a series of static methods for sorting, querying, and modifying collection elements, as well as providing methods for setting immutable set objects, synchronizing control of collection objects , and so on.7 8 Sort operations: (both static methods) are list9 ---> Reverse (list): Reverses the order of elements in a listTen ---> Shuffle (list): Randomly sort the elements of a List collection One ---> Sort (list): Sorts the specified List collection elements in ascending order based on the natural ordering of the elements A ? Sort (list,comparator): Sorts the List collection elements according to the order in which the specified Comparator is produced - ? Swap (list,int, int): Swaps the I and J elements in the specified list collection - ? void copy (List dest,list src): Copy content from SRC to dest the Find Replacements - ? Object Max (Collection): Returns the largest element in a given set, based on the natural order of the element - ? Object Max (Collection,comparator): Returns the largest element in a given set, based on the order specified by Comparator - ? Object min (Collection) + ? Object min (collection,comparator) - ---> int frequency (collection,object): Returns the number of occurrences of the specified element in the specified collection + ? Boolean replaceall (List List,object oldval,object newval): Replaces all old values of the List object with the new value A at */ - Public classCollections_method { - -}
Java Basic Notes--collection tool class