Thanks for the link,

Notice however that I'm not using the map as a key in itself, but as a
value in itself, and as a key in another unrelated map.


On Jan 3, 11:36 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> Have you seen this note in the javadoc for java.lang.Map:
>
> Note: great care must be exercised if mutable objects are used as map keys.
> 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. While it is permissible for a map to contain
> itself as a value, extreme caution is advised: the equals and hashCode
> methods are no longer well defined on such a map.
>
> –http://download.oracle.com/javase/6/docs/api/java/util/Map.html
>
> Instead of using a Map directly, maybe you should use an wrapper object that
> implements equals() and hashCode() independently of the content of the Map.
> Or, instead of using the Map itself as the key, use a "sentinel" object
> (e.g. public static final Object THIS_MAP = new Object(); )
>
> (that being said, I'm having a hard time figuring out what could represent a
> Map that contains itself as a *key*)

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to