Collections类是什么
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/e89be75b8862d138f6c592483f914ed7.png)
Collections类的使用
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
public class Test04 {
public static void main(String[] args) {
ArrayList<Integer> arrayList=new ArrayList<>();
arrayList.add(5);
arrayList.add(3);
arrayList.add(4);
arrayList.add(2);
arrayList.add(1);
Collections.sort(arrayList);
System.out.println(arrayList.get(0));
System.out.println(arrayList.get(arrayList.size()-1));
Integer max = Collections.max(arrayList);
Integer min = Collections.min(arrayList);
System.out.println("max="+max);
System.out.println("min"+min);
HashSet<Character> hash=new HashSet<>();
hash.add('c');
hash.add('b');
hash.add('a');
hash.add('a');
hash.add('f');
hash.add('k');
System.out.println(Collections.max(hash));
System.out.println(Collections.min(hash));
Collections.max(hash);
Collections.min(arrayList);
Collections.sort(arrayList);
}
}