Java tutorial
import java.util.HashMap; import java.util.Map; import java.util.WeakHashMap; public class Main { public static void main(String[] args) { WeakHashMap<String, String> hashMap = new HashMap<String, String>(); hashMap.put("1", "first"); hashMap.put("2", "two"); hashMap.put("3", "from java2s.com"); Map<String, String> weakHashMap = new WeakHashMap<String, String>(hashMap); } }