+
+ return Optional.of(epAppFunctionDao.getAppRoleFunctionList(roleId, appId))
+ .orElse(new ArrayList<>())
+ .stream()
+ .filter(distinctByKey(EpAppFunction::getAppId))
+ .filter(distinctByKey(EpAppFunction::getFunctionCd))
+ .filter(distinctByKey(EpAppFunction::getFunctionName))
+ .collect(Collectors.toList());
+ }
+
+ private <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
+ List<Object> seen = new ArrayList<>();
+ return t -> seen.add(keyExtractor.apply(t));