Here you can find the source of createMap(List keys, List values)
public static <A, B> Map<A, B> createMap(List<A> keys, List<B> values)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.List; import java.util.Map; public class Main { public static <A, B> Map<A, B> createMap(List<A> keys, List<B> values) { Map<A, B> map = new HashMap<A, B>(); for (int i = 0; i < keys.size(); i++) { if (i == values.size()) { break; }/*from ww w . j av a 2 s. c om*/ map.put(keys.get(i), values.get(i)); } return map; } }