I want to use MultiKeyMap from Apache Collection, because I need a HashMap with two keys and a value.
To put elements I do this:
private MultiKeyMap multiKey = new MultiKeyMap();
multiKey.put("key1.1", "key2.1", "value1");
And for get element I do this:
String s = multiKey.get("key1.1");
But the String s cames null… If I pass the two keys, like that:
String s = multiKey.get("key1.1", "key2.1");
The String s cames with values value1…
How can I extend the MultiKeyMap to get the right value when I pass only one of the two keys?
If you need only one key to get a value you have a plain old HashMap.
And for get element you can do this:
MultiKeyMap is required when both keys must be provided.