TreeMap randomly stops properly returning values

Posted by smessing on Stack Overflow See other posts from Stack Overflow or by smessing
Published on 2010-04-21T03:00:34Z Indexed on 2010/04/21 3:13 UTC
Read the original article Hit count: 343

Filed under:
|

I have the following TreeMap:

TreeMap<String, Integer> distances = new TreeMap<String, Integer>();

and it contains both strings, "Face" and "Foo", with appropriate values, such that:

System.out.println(distances); 

Yields:

{Face=12, Foo=2}

However, distances.get(Face) returns null, even though distances.get(Foo) properly returns 2. Previously, distances.get(Face) worked, but for some reason, it stopped working. Note I print out the map right before calling get() for both keys, so I haven't accidentally changed Face's value to null. Has anyone else ever encountered this problem? Is there anything I can do? I'm having a terrible time simply trying to figure out how to debug this problem.

© Stack Overflow or respective owner

Related posts about java

Related posts about treemap