Here you can find the source of createMap(K[] keys, V[] values)
public static <K, V> Map<K, V> createMap(K[] keys, V[] values)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; public class Main { public static <K, V> Map<K, V> createMap(K[] keys, V[] values) { assert keys.length == values.length : "Lengths of keys and values should be the same"; Map<K, V> res = new HashMap<>(keys.length); for (int i = 0; i < keys.length; i++) res.put(keys[i], values[i]); return res; }/*from w w w. j a va2 s . c o m*/ }