import java.util.Iterator; import java.util.Map; import java.util.WeakHashMap; public class Main { public static void main(String[] argv) throws Exception { Map weakMap = new WeakHashMap(); Object keyObject = ""; Object valueObject = ""; weakMap.put(keyObject, valueObject); Iterator it = weakMap.keySet().iterator(); while (it.hasNext()) { Object key = it.next(); } } }