package WangGang01;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collector;
public class Dome07 {
public static void main(String[] args) {
//Collection不支持创建对象,因为构造器私有化了
//Collections cols =new Collections();
//里面的属性和方法都是被static修饰,我们可以直接用类名,去调用即可
//常用方法
//addAll
ArrayList<String> strings = new ArrayList<>();
strings.add("bb");
strings.add("aa");
strings.add("cc");
Collections.addAll(strings,"dd","ee","ff");
Collections.addAll(strings,new String[]{"66","55","SD"});
System.out.println(strings);
Collections.sort(strings);//sort提供了一个升序的排列
System.out.println(strings);
//copy替换
ArrayList<String> strings1 = new ArrayList<>();
Collections.addAll(strings1,new String[]{"5","6"});
Collections.copy(strings,strings1);
System.out.println(strings);
System.out.println(strings1);
//fill填充
Collections.fill(strings,"666");
System.out.println(strings);
}
}
colleations工具类