1public static <T, E> Set<T> getKeyByValue(Map<T, E> map, E value) {
2 return map.entrySet()
3 .stream()
4 .filter(entry -> Objects.equals(entry.getValue(), value))
5 .map(Map.Entry::getKey)
6 .collect(Collectors.toSet());
7}