Given the value, I need to get the index or key which this value belongs in a Map without the need to iterate it. I’m using java.
Thanks
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.
Guava has a BiMap, which is a bidirectional map (each key and each value are unique).
If you don’t waht to use an external library, you only have 2 options:
HashMapand you will need to iterate over the keys