public static void main(String[] args){
Map<String,String> map= new HashMap<>();
map.forEach((k,v)->{
// 打印键
System.out.println(k);
// 打印值
System.out.println(v);
}); List<Stu> list = new ArrayList();
list.forEach((l)->{
System.out.println(l.getId());
System.out.println(l.getName());
}); Set<Stu> set = new HashSet<>();
set.forEach((s)->{
System.out.println(s.getId());
System.out.println(s.getName());
});
}
05-28 21:25