I am across situation where I will be changing key based on value in HashMap. My HashMap is:
HashMap<Key, Path>
Initially I am creating Keys for each directory Path and putting these entries in HashMap. When doing processing, I will take Path based on Key from HashMap and process them. In some cases I will be re-calculating Key for some Path and want to replace old Key with new Key for that Path. I want to keep unique Keys for unique Paths and update Entry in HashMap with either one. So I want to perform reverse of HashMap to update Key. What is best technique for this?
Thanks in Advance.
May be you are looking for Google Guava’s
BiMap.