-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b51
-
generic
-
generic
-
Verified
This program
------------------------------------------------------------
import java.util.*;
import java.util.concurrent.*;
public class Bug {
public static void main(String[] args) throws Exception {
Map m = new ConcurrentHashMap();
m.put(1,2);
Iterator it = m.entrySet().iterator();
if (it.hasNext()) {
m.remove(1); // sneaky
System.out.println(it.next());
}
}
}
------------------------------------------------------------
prints
1=null
which is very surprising, since 1 was never mapped to null,
and in fact, it could never be.
------------------------------------------------------------
import java.util.*;
import java.util.concurrent.*;
public class Bug {
public static void main(String[] args) throws Exception {
Map m = new ConcurrentHashMap();
m.put(1,2);
Iterator it = m.entrySet().iterator();
if (it.hasNext()) {
m.remove(1); // sneaky
System.out.println(it.next());
}
}
}
------------------------------------------------------------
prints
1=null
which is very surprising, since 1 was never mapped to null,
and in fact, it could never be.