Written by
java-style
on
on
리스트 객체 중복 제거
리스트 객체 중복 제거
728x90
반응형
/** * @param list 중복이 있는 리스트 * @param key 중복 여부를 판단하는 키값 * @param 제네릭 타입 * @return List */ public List deduplication(ArrayList list, Function key){ return list.stream().filter(deduplication(key)).collect(Collectors.toList()); } public Predicate deduplication(Function key){ Set set = ConcurrentHashMap.newKeySet(); return predicate ->set.add(key.apply(predicate)); }
참고 :
https://sunghs.tistory.com/130
728x90
반응형
from http://machine-woong.tistory.com/479 by ccl(A) rewrite - 2021-10-08 12:27:14