I have the following BiMap collections:
BiMap<String,String> accessIds = HashBiMap.create();
accessIds.put("FOO","accessId 1"); //This access Id is common to both FOO and BAR
BiMap<String,String> merchants = HashBiMap.create();
merchants.put("FOO", "merchant 1"); //Both FOO and BAR each have unique merchants
merchants.put("BAR", "merchant 2");
These are 2 of the 4 total collections I currently have. All 4 collections share the same keys, but different values.
The question I have is: How can I ensure that I can get merchant 2
when I have an accessIds key of FOO
?
Before someone points out that these two collections do not, in fact, share the same keys, please remember that a BiMap enforces unique values so I am unable to list "BAR","accessId 1"
in the collection.
I'm not convinced that BiMap is the right collection, but I do make use of its inverse()
method. If there is a collection better suited ( or some other method that I am overlooking ) please let me know.
FYI: I use Guava-14.0-rc1 for the BiMap collection.