Java Map Put putObjectsInMultiMap(Map>> multiMap, Integer key, List stringPair)

Here you can find the source of putObjectsInMultiMap(Map>> multiMap, Integer key, List stringPair)

Description

Utility function for placing objects in a Map.

License

Open Source License

Parameter

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

Declaration

private static void putObjectsInMultiMap(Map<Integer, List<List<String>>> multiMap, Integer key,
        List<String> stringPair) 

Method Source Code

//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);
    }
}

Related

  1. putModifiedAttribute(Map aMap, String name, Object value)
  2. putMultiEntry(Map map, Iterable keys, V value)
  3. putMultiple(Map map, Object key, Object value)
  4. putNotDup(Map tbl, String key, String value)
  5. putObject(Map map, V key, W value)
  6. putOrCreateList(Map> map, K key, V value)
  7. putOrRemove(Map map, String key, Object obj)
  8. putPairs(Map map, Object... pairs)
  9. putParameter(String key, String value, Map map)