Collection是个接口,Collections是个类。。
Collection 是个集合接口。Collections是个方法类,里面提供了好多静态方法,可以直接调用。
Collection如下图:
Collections如下:
List<Integer> list = new ArrayList<Integer>();
list.add(12);
list.add(20);
Collections.sort(list);
System.out.println(list); // [12, 20]