HashMap with multiple Value [duplicate]
问题 This question already has answers here : HashMap with multiple values under the same key (20 answers) Closed 4 years ago . I want to implement Hash table with multiple values in java i.e // if sample is a hashmap sample.put(1,1); sample.put(1,2); and sample.get(1); will return 2 values. How can i achieve this? 回答1: You can use a Multimap instead. It keeps multiple values for a key in a list. There are implementations in commons-collections and in Guava. Multimap<String, String> multimap =