/ ** * 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