Here you can find the source of getWeakHashMap()
public static <K, V> Map<K, V> getWeakHashMap()
//package com.java2s; import java.util.Map; import java.util.WeakHashMap; public class Main { public static <K, V> Map<K, V> getWeakHashMap() { return new WeakHashMap<K, V>(); }//w ww.j a va 2 s . co m public static <K, V> Map<K, V> getWeakHashMap(int initialCapacity) { return new WeakHashMap<K, V>(initialCapacity); } public static <K, V> Map<K, V> getWeakHashMap(Map<? extends K, ? extends V> map) { return new WeakHashMap<K, V>(map); } public static <K, V> Map<K, V> getWeakHashMap(int initialCapacity, float loadFactor) { return new WeakHashMap<K, V>(initialCapacity, loadFactor); } }