jdk1.8 lambda表达式对集合的操作

去重:
List unique = doccodeList.stream().distinct().collect(Collectors.toList());

判空:

List doccodeList = allCuiji.stream().map(CuijiBean::getDoccode).filter(x -> x !=null&&! x.equals("") ).collect(Collectors.toList());

根据属性过滤:

List filterList = allCuiji.stream().filter(a ->
                                       one.equals(a.getDoccode())).collect(Collectors.toList());

 

你可能感兴趣的:(集合操作,lambda)