集合的forEach遍历
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("萧炎");
arrayList.add("唐三");
arrayList.add("石昊");
arrayList.add("夏新");
arrayList.forEach(x-> System.out.println("name = " + x));
TreeSet<FY> treeSet = new TreeSet<>();
FY a1 = new FY ("帝释天",1);
FY a2 = new FY ("无名",2);
FY a3 = new FY ("聂风",3);
FY a4 = new FY ("步惊云",4);
treeSet.add(a1);
treeSet.add(a2);
treeSet.add(a3);
treeSet.add(a4);
treeSet.forEach(x -> {System.out.println("id = " + x.getId() + ",name = " + x.getName());});
HashMap<Integer,String> hashMap = new HashMap<>();
hashMap.put(1,"李白");
hashMap.put(2,"韩信");
hashMap.put(3,"十步杀一人");
hashMap.put(4,"国士无双");
hashMap.forEach((K,V)-> System.out.println("id = " + K + ",data = " + V));