Are WeakHashMap cleared during a full GC?
问题 I encountered some troubles with WeakHashMap. Consider this sample code: List<byte[]> list = new ArrayList<byte[]>(); Map<String, Calendar> map = new WeakHashMap<String, Calendar>(); String anObject = new String("string 1"); String anOtherObject = new String("string 2"); map.put(anObject, Calendar.getInstance()); map.put(anOtherObject, Calendar.getInstance()); // In order to test if the weakHashMap works, i remove the StrongReference in this object anObject = null; int i = 0; while (map.size(