Java – a faster way to find the key for a given value from the map?
•
Java
I want to find the key of a given value from HashMap. At present, I have to pass all keys and check its value in the map. Is there a faster way?
Solution
No, there is no faster way (no other data structure is introduced) If you need to do this often, please reconsider your design Maybe you want another HashMap whose key is the value of another HashMap?
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码