Please forgive this rather basic question, but I’m very new to Java and still finding my way.
I’m writing a web scraper and need to store key:value data in some way. I’ve used HashMaps until now which have been great, except that now I need to allow duplicate values for unique keys. For example, this should be allowed:
Key:Value
abc : 123
cde : 727
efg : 123
hij : 123
klo : 876
opa : 909
Can anyone advise what would be best to use in these circumstances?
Thanks
This is already possible using
java.util.HashMap. It’s duplicate Keys that are not possible.From java.util.MapJavaDoc (implemented by HashMap).