import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
public class Set1 {
public static void main(String[] args) {
//Collection->List ArrayList
var list = new ArrayList<Integer>(List.of(11, 22, 33, 11, 44, 55, 11, 66));
System.out.println(list.size());
System.out.println(list);
//Collection->Set HashSet(集合对象不能重复,重复保留一个,元素没有顺序,不参随机访问
var set = new HashSet<Integer>(List.of(11, 22, 33, 11, 44, 55, 11, 66));
System.out.println(set.size());
System.out.println(set);
System.out.println(set.contains(11)); //true
set.remove(66);
set.removeAll(List.of(55, 44, 11));
System.out.println(set);
//遍历
for(Integer i : set){
System.out.println(i);
}
//lambda forEach表达 遍历输出
set.forEach(System.out::println);
}
}