JDK1.8去重
1、按照对象中的一个或多个属性去重
List clientGatherList= BeanConvertUtil.convertList(postRealtimeVisitClientInput.getClientData(), Clientgather.class); // 根据client_id 数据去重 clientGatherList = clientGatherList.stream().collect(Collectors.collectingAndThen( Collectors.toCollection( () -> new TreeSet<>(Comparator.comparing(o -> o.getClientId() ))), ArrayList::new));
// 根据client_id 和 fund_account对数据去重
clientGatherList = clientGatherList.stream().collect(Collectors.collectingAndThen( Collectors.toCollection( () -> new TreeSet<>(Comparator.comparing(o -> o.getClientId() + “;” + o.getFundAccount()))), ArrayList::new));

浙公网安备 33010602011771号