Here you can find the source of putToListMap(Map mapOfLists, Object key, Object val)
@SuppressWarnings({ "unchecked", "rawtypes" }) public static void putToListMap(Map mapOfLists, Object key, Object val)
//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); } }