/* reverse(List): Reverse the order of elements in a List
* shuffle(List): Random sorting of List set elements
* sort(List): Sort the elements of a specified List collection in ascending order according to the natural order of the elements
* sort(List,Comparator): List collection elements are generated in the order specified by the Comparator
* Sort
* swap(List,int,int): Exchanges elements at i and j in the specified list collection
* Object max(Collection): Returns the largest element in a given set according to the natural order of the elements
* Object max(Collecton,Comparator) returns to a given set in the order specified by the Coparator
* Maximum element
* Object min(Collection):
* Object min(Collection,Comparator)
* int frequency(Collection,Object) returns the number of occurrences of a specified element in a specified collection
* void copy(List dest,list src) copies the contents of Src into dest
* Boolean replaceAll (List, Object oldAal, Object newVAL): Replace List with a new value
* All old values
*
*
*/
```java public class TestCollections { /*reverse(List):Reverse the order of elements in a List * shuffle(List):Random Sorting of List Set Elements * sort(List):Sort the elements of the specified List collection in ascending order according to the natural order of the elements * sort(List,Comparator): List collection elements in the order generated by the specified Comparator * Sort * swap(List,int,int): Exchange elements at i and j in the specified list set * Object max(Collection):Returns the largest element in a given set according to its natural order * Object max(Collecton,Comparator)Returns to a given set in the order specified by Coparator * Maximum element * Object min(Collection): * Object min(Collection,Comparator) * int frequency(Collection,Object)Returns the number of occurrences of the specified element in the specified collection * void copy(List dest,list src)Copy the contents of Src into dest * boolean replaceAll(List list,Object oldAal,Object newVAL):Replace List with a new value * All old values * * */ @Test public void testCollectons1() { List list = new ArrayList(); list.add(123); list.add(456); list.add(12); list.add(78); System.out.println(list); Collections.reverse(list); System.out.println(list); Collections.shuffle(list); System.out.println(list); Collections.sort(list); System.out.println(list); Collections.swap(list, 0, 1); System.out.println(list); List list1 = Arrays.asList(new Object[list.size()]); Collections.copy(list1, list); System.out.println(list1); } @Test public void test0() { List list = new ArrayList(); list.add(123); list.add(456); list.add(12); list.add(78); Object obj = Collections.max(list); System.out.println(obj); int count = Collections.frequency(list, 456); System.out.println(count); //Ensure the thread security of list by following methods. List list2 = Collections.synchronizedList(list); System.out.println(list2); Collections.replaceAll(list2, 456, new Person("Lu Ben Wei",22)); System.out.println(list2); } }