Here you can find the source of hashMap()
public static <K, V> HashMap<K, V> hashMap()
//package com.java2s; /*// ww w .j a va 2 s . c om * @(#)MapHelper.java 2011-9-30 * ?????????us?????????? ? 2008-2011, Inc. All rights reserved. * ?s.server. Use is subject to license terms. */ import java.util.HashMap; import java.util.Map; public class Main { public static <K, V> HashMap<K, V> hashMap() { return new HashMap<K, V>(); } public static <K, V> Map<K, V> hashMap(K key, V val) { Map<K, V> map = new HashMap<K, V>(); map.put(key, val); return map; } }