//stream方法privatestatic<T>Predicate<T>distinctByKey(Function<?superT,?> keyExtractor){Set<Object> seen =ConcurrentHashMap.newKeySet();return t -> seen.add( keyExtractor.apply( t ));}//去重
collect = list.stream().filter(distinctByKey(Product::getName)).collect(Collectors.toList());