Here you can find the source of newHashMap(T key, U value)
public static <T, U> Map<T, U> newHashMap(T key, U value)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.Map; public class Main { public static <T, U> Map<T, U> newHashMap(T key, U value) { Map<T, U> m = new HashMap<T, U>(); m.put(key, value);// w w w .java 2 s. co m return m; } public static <T, U> Map<T, U> newHashMap(T[] keys, U[] values) { Map<T, U> m = new HashMap<T, U>(); for (int i = 0; i < keys.length; i++) { m.put(keys[i], values[i]); } return m; } }