Here you can find the source of putObjectsInMultiMap(Map
Parameter | Description |
---|---|
multiMap | A Map object which takes Integer as a key and list of list of String as value |
key | A Key for the map |
stringPair | A value for the map |
private static void putObjectsInMultiMap(Map<Integer, List<List<String>>> multiMap, Integer key, List<String> stringPair)
//package com.java2s; // of the Adobe license agreement accompanying it. import java.util.ArrayList; import java.util.List; import java.util.Map; public class Main { /**/*from www .j a va2 s . c o m*/ * Utility function for placing objects in a Map. It behaves like a multi map. * * @param multiMap * A Map object which takes Integer as a key and list of list of String as value * @param key * A Key for the map * @param stringPair * A value for the map * */ private static void putObjectsInMultiMap(Map<Integer, List<List<String>>> multiMap, Integer key, List<String> stringPair) { if (multiMap == null) return; List<List<String>> tempList = multiMap.get(key); if (tempList == null) { tempList = new ArrayList<List<String>>(); multiMap.put(key, tempList); } tempList.add(stringPair); } }