elements.stream()
.collect(Collectors.toMap(
obj -> extractKey(obj),
obj -> obj,
(first, second) -> first
// pick the first if multiple values have the same key
).values().stream();
Set<String> collect = itemDtoList.stream().map(p -> p.getEcrfItemId()).collect(Collectors.toSet());