Bi-directional Map in Java?

The Solution to Bi-directional Map in Java? is


You can use the Google Collections API for that, recently renamed to Guava, specifically a BiMap

A bimap (or "bidirectional map") is a map that preserves the uniqueness of its values as well as that of its keys. This constraint enables bimaps to support an "inverse view", which is another bimap containing the same entries as this bimap but with reversed keys and values.

~ Answered on 2012-05-22 09:44:40


Most Viewed Questions: