private static PredicatedistinctByKey(Function keyExtractor) {
Map seen =new ConcurrentHashMap<>();
return t ->seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) ==null;
}
public ListselectMenuTreeAll(List<SysMenu> list ) {
if(CollUtil.isNotEmpty(list)){
list = list.stream().filter(distinctByKey(SysMenu::getMenuId)).collect(Collectors.toList());
}
return list;
}