expungeStaleEntries in WeakHashMap
In WeakHashMap.expungeStaleEntries method of JDK 1.5, I see following code:
e = (Entry<K,V>) queue.poll()
But while creating Entry, only key is added to WeakReference:
Entry(K key, V value, ReferenceQueue<K> queue, int hash, Entry<K,V> next) {
super(key, queue);
this.value = value;
this.hash = hash;
this.next = next;
}
So my question is: The WeakReference has only key, so how come on polling queue an object of type Entry is retrieved?

