I want to find out the key for given value from HashMap, currently I have to go through all keys and check its value in map, is there a faster way?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is not a faster way (without introducing other data structures). If you need to do this often, reconsider your design. Maybe you want another
HashMapwhose keys are the values of the otherHashMap?