Created
March 29, 2016 03:20
-
-
Save shangoyanyi/eb68d2dad701a40b770b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static <T, E> Set<T> getKeysByValue(Map<T, E> map, E value) { | |
Set<T> keys = new HashSet<T>(); | |
for (Entry<T, E> entry : map.entrySet()) { | |
if (entry.getValue().equals(value)) { | |
keys.add(entry.getKey()); | |
} | |
} | |
return keys; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment