java8 lamda expression according to weight a list, according to a list of elements


/ ** * specified according to the field list to re * @param list * @return * / public static List <the DataModel> niqueList (List <the DataModel> list) { // deduplication, the code field according to List <DataModel> uniqueList = list .stream () the collect (. collectingAndThen ( toCollection (() -> new new TreeSet <> (Comparing (N-> n.getCode ()))), the ArrayList :: new new) ); return uniqueList; }

 list java8 element according to the specified weight 

Guess you like

Origin www.cnblogs.com/wangzhengyu/p/11985552.html