Best way to create a hashmap of arraylist

后端 未结 9 1050
小鲜肉
小鲜肉 2020-11-27 05:35

I have one million rows of data in .txt format. the format is very simple. For each row:

user1,value1
user2,value2
user3,value3
user1,value4
...

You k

9条回答
  •  一生所求
    2020-11-27 06:26

    i think what you want is the Multimap. You can get it from apache's commons collection, or google-collections.

    http://commons.apache.org/collections/

    http://code.google.com/p/google-collections/

    "collection similar to a Map, but which may associate multiple values with a single key. If you call put(K, V) twice, with the same key but different values, the multimap contains mappings from the key to both values."

提交回复
热议问题