List<User> list1=new ArrayList<>();
User u1=new User1(“name1”,1);
User u2=new User1(“name2”,1);
list1.add(u1);
list1.add(u2);
List<User> list2=new ArrayList<>();
User u3=new User1(“name1”,1);
User u4=new User1(“name2”,1);
list2.add(u3);
list2.add(u4);
list1=list1.stream().filter(
!i->list2.stream().map(User::getName).collect(Collector.toList())
.contains(i.getName())
).collect(Collector.toList());
System.out.println(list1);
//输出信息:user2信息