I would like to iterate over a hashmap with Java 8, comparing its keys to a given list (containing objects with key ID) and return the values from the hashmap where the key of the hashmap and the key of the object in the list are equal. I can't figure this out.
I try to accomplish something like this:
someHashMap.entrySet()
.stream()
.filter(entry -> entry.getValue().equals(something.stream().iterator().next().getID()))
.map(map -> map.getValue())
.collect(Collectors.toList());