+ 1

Hot to access key from value in hashmap

Method or code to access key

10th Mar 2021, 6:49 AM
Saurav Kokane
Saurav Kokane - avatar
2 odpowiedzi
+ 2
How will you? MANY keys might have same value. Iteration through keys should do it.
10th Mar 2021, 7:14 AM
Oma Falk
Oma Falk - avatar
+ 2
Saurav Kokane Since this is an operation that can produce more than one pair you need iterate using entrySet() and comparing with entry.getValue() to add each match to your result data structure. E.g. List or Set
13th Mar 2021, 2:41 AM
David Ordás
David Ordás - avatar