Code: Select all
Map<Map<?, ?>, String> m = new HashMap<Map<?, ?>, String>();
m.put(m, "value");
System.out.println(m);
Code: Select all
{(this Map)=value}
Moderator: admin
Code: Select all
Map<Map<?, ?>, String> m = new HashMap<Map<?, ?>, String>();
m.put(m, "value");
System.out.println(m);
Code: Select all
{(this Map)=value}
The behavior of a map is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is a key in the map. A special case of this prohibition is that it is not permissible for a map to contain itself as a key.
Users browsing this forum: No registered users and 8 guests