1 Map<String, List<String>> myMaps = new HashMap<String, List<String>>();
2 for (DataObject item : myList) {
3 if (!myMaps.containsKey(item.getKey())) {
4 myMaps.put(item.getKey(), new ArrayList<String>());
5 }
6 myMaps.get(item.getKey()).add(item.getValue());
7 }
8
1 Map<String, List<String>> myMaps = new HashMap<String, List<String>>();
2 for (DataObject item : myList) {
3 if (!myMaps.containsKey(item.getKey())) {
4 myMaps.put(item.getKey(), new ArrayList<String>());
5 }
6 myMaps.get(item.getKey()).add(item.getValue());
7 }