Java HashMap uses put method to insert the K/V pair in HashMap. Lets say I have used put method and now HashMap<
HashMap
put
HashMap<
It isn't defined to do so. In order to achieve this functionality, you need to create a map that maps keys to lists of values:
Map> myMap;
Or, you could use the Multimap from google collections / guava libraries