Here you can find the source of newHashMap()
Parameter | Description |
---|---|
K | a parameter |
V | a parameter |
public static <K, V> Map<K, V> newHashMap()
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { /**/* ww w .ja va 2 s .c o m*/ * Constructs an empty <tt>HashMap</tt> with the default initial capacity * (16) and the default load factor (0.75). * * @param <K> * @param <V> * @return */ public static <K, V> Map<K, V> newHashMap() { return newHashMap(16); } /** * Constructs an empty HashMap with the specified initial capacity and the default load factor (0.75). * * @param <K> * @param <V> * @param initialCapacity * @return */ public static <K, V> Map<K, V> newHashMap(int initialCapacity) { return new HashMap<K, V>(initialCapacity); } }