Java Map Put putToListMap(Map mapOfLists, Object key, Object val)

Here you can find the source of putToListMap(Map mapOfLists, Object key, Object val)

Description

put To List Map

License

Apache License

Declaration

@SuppressWarnings({ "unchecked", "rawtypes" })
    public static void putToListMap(Map mapOfLists, Object key, Object val) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import java.util.List;
import java.util.Map;

public class Main {
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static void putToListMap(Map mapOfLists, Object key, Object val) {
        List list = (List<?>) mapOfLists.get(key);
        if (list == null) {
            list = new ArrayList<>();
            mapOfLists.put(key, list);//ww w  . j  av a 2  s  .com
        }
        list.add(val);
    }
}

Related

  1. putParameter(String key, String value, Map map)
  2. putPreferenceStoredMapValue(String keyOfPreference, String keyInMap, Object value)
  3. putRowMap(Map map, String value)
  4. putSafelyMap(Map> pathFeaturesMap, K1 featureDescriptor, K2 pathId, E featureValue)
  5. putShort(Map properties, String name, short value)
  6. putToMapIfNotNull(Map map, final String key, final String value)
  7. putToMapMap(Map> map1, K1 key1, K2 key2, V value)
  8. putUnique(Map map, long key, V v)