I have once scenario where I have to store duplicate keys (string) and values (string) in Map. I tried with MultiHashMap (Apache) but it's very specific to datatype. It will only allow "string" key and "integer" value.
How can I do it? Any help will be appreciated.
Stupid question perhaps, but a regular HashMap with a String as a key and an ArrayList as a value doesn't cut it? You really NEED duplicate keys also?
EDIT: yes that is a stupid suggestion; of course you need duplicate keys when it is in fact a duplicate key/value pair that we're talking about.
It will only allow "string" key and "integer" value.
When I look at the Javadoc I see it is controlled by generics, just like the regular Map type. Here, even in this very old javadoc:
You can see that put() takes two Object values, not a String and an Integer.