EVALUATION
The deeper problem of returning the same object on each call to next()
is being addressed via 6312706. Most of the obvious manifestations
of that behavior are being fixed here.

2005-08-18

EVALUATION
Has the same root cause as
6197726: (coll) IdentityHashMap.entrySet().toArray(T[] a) is incorrectly implemented
The deeper problem is that IdentityHashMap.iterator() wants to return the *same* entry
(with different keys and values) for every call to next(), which is a very bad idea.
Hmmmmm...found the contributed fix just now... I was thinking on exactly the same lines...
The proposed fix for 6197726 appears to make the submitted test work again, but
the deeper problem remains. A more comprehensive fix on the lines of the contributed
fix is needed.
BTW, here's a simpler test case:
--------------------------------------------------------------
import java.util.*;
public class Bug {
public static void main(String [] args) throws Exception {
Map<String,String> map = new IdentityHashMap<String,String>();
map.put("foo", "bar");
map.put("baz", "quux");
ArrayList<Map.Entry<String,String>> ls
= new ArrayList<Map.Entry<String,String>>(map.entrySet());
System.out.println("ls: " + ls);
LinkedList<Map.Entry<String,String>> ls2
= new LinkedList<Map.Entry<String,String>>(map.entrySet());
System.out.println("ls2: " + ls2);
}
}
--------------------------------------------------------------