[fedora-java] Bug in openjdks TreeMap?

Christoph Höger choeger at cs.tu-berlin.de
Fri May 8 13:36:31 UTC 2009


Hi,

I enounter a very odd behaviour of a TreeMap. This is the code fragment:

			System.err.println("contains: " +
state.getIndexMap().containsKey(termString));
			for (TerminalString term : state.getIndexMap().keySet())
				System.err.println("KEYS: " + term + "==" + termString +":" +
term.equals(termString) + " compare: " +
state.getIndexMap().comparator().compare(term, termString));

The TreeMap returned getIndexMap contains mappings from TerminalString
to Integer.
This is the output:

contains: false
KEYS: redeclare (1581148120) ==redeclare (1581148120) :true compare: 0

So the key _is_ in that map. It also has the very same hashcode and the
comparator returns 0 and equals() is true. But still containsKey returns
zero.
Any guess why that?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://listman.redhat.com/archives/fedora-devel-java-list/attachments/20090508/731bb14e/attachment.sig>


More information about the fedora-devel-java-list mailing list