2021
03-19
03-19
java8实现List中对象属性的去重方法
java8的stream流能完美解对象集合去重问题.List<UserCar>list1=newArrayList();UserCaruserCar=newUserCar();userCar.setId(1);userCar.setCarNo("AA");list1.add(userCar);UserCaruserCar1=newUserCar();userCar1.setId(2);userCar1.setCarNo("AA");list1.add(userCar1);Personp1=newPerson(1,"11");Personp2=newPerson(1,"22");Personp3=newPerson(2,"11");List<Person>persons=Arra...
继续阅读 >