代码如下:
package CollectionDemo01;import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;public class CollectionDemo01 {public static void main(String[] args){List<Integer> list = new ArrayList<Integer>();list.add(30);list.add(20);list.add(50);list.add(10);list.add(40);System.out.println(list);Collections.sort(list);System.out.println(list);Collections.reverse(list);System.out.println(list);Collections.shuffle(list);System.out.println(list);}
}