Map with multiple keys mapped to a single value in Java?

What I need is a Map that maps multiple keys to a single value (3 keys to 1 value in my case) such that 3 keys together uniquely identifies a value. This can easily be done with nested Maps such as:

Map>> map = new HashMap<>();

Object value = map.get("foo").get(3).get(1.23);

However, I also want to be able to get a list of values by only using some of the keys, such as:

List values1 = map.get("foo"); // All values with "foo" as its String-key

List values2 = map.get(3).get(1.23); // All...

Read More »

By: StackOverFlow - 6 days ago

Related Posts