java map string to list

htt‮.www//:sp‬lautturi.com
java map string to list
Map<String, List<String>> myMaps = new HashMap<String, List<String>>();
for (DataObject item : myList) {
    if (!myMaps.containsKey(item.getKey())) {
        myMaps.put(item.getKey(), new ArrayList<String>());
    }
    myMaps.get(item.getKey()).add(item.getValue());
}
Created Time:2017-10-04 14:06:08  Author:lautturi