I found the following statement:
Map is an object that stores key/volume pairs. Given a key, you can find its value. Keys must be unique, but values may be duplicated.
For example I have just one key/value pair (3,4). And now I put
a new pair (3,5). It will remove the old pair. Right? But if I put
(2,4) instead of (3,4) I will add a new pair of key/value to the HashMap. Right?
The answer to the question in your title is "No". The answer to the question in your message is "Yes". If you want a bidirectional map with unique keys and unique values as asked in your title (also called a key-key map), have a look at Guava BiMap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With