Java examples for java.util:Collection Creation
Create new Hash Map
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { public static void main(String[] argv) { System.out.println(newHashMap()); }//from w w w . j av a 2 s . c o m public static <K, V> HashMap<K, V> newHashMap() { return new HashMap<K, V>(); } public static <K, V> HashMap<K, V> newHashMap(final int initialCapacity) { return new HashMap<K, V>(initialCapacity); } public static <K, V> HashMap<K, V> newHashMap( final int initialCapacity, final float loadFactor) { return new HashMap<K, V>(initialCapacity, loadFactor); } public static <K, V> HashMap<K, V> newHashMap( final Map<? extends K, ? extends V> m) { return new HashMap<K, V>(m); } }