Re: ClassCastException when changing from HashMap to TreeMap

2008-10-17 Thread Kris Schneider
It looks like it might be a difference in the way HashMap.containsKey and TreeMap.containsKey are implemented. If you look at the API docs, TreeMap will throw ClassCastException but HashMap will not. When you were using HashMap, did you actually get values returned or null? On Fri, Oct 17, 2008

Re: ClassCastException when changing from HashMap to TreeMap

2008-10-17 Thread Gabriel Belingueres
I now I realize that it is returning nothing on ${map[param.myid]} with HashMap. But surprisingly even though I know for sure that map[3] exists, then ${map[3]} (with the literal 3) returns nothing too...I remember previously having an issue with this because IIRC JSTL converts the 3 to a Long,

Re: ClassCastException when changing from HashMap to TreeMap

2008-10-17 Thread Kris Schneider
HashMap will essentially just use the hashCode value of the key to do the lookup. So, when using 3, the hashCode value is 51. But for both Integer(3) and Long(3), the hashCode value is 3. If the conversion is actually to BigDecimal, then the hashCode value of BigDecimal(3) is 93 and that might

Re: ClassCastException when changing from HashMap to TreeMap

2008-10-17 Thread Kris Schneider
Just ran a couple quick tests, and it looks like integer literals are converted to Long. I completely blocked on the fact that HashMap will also attempt to do aLong.equals(anInteger), which will fail. On Fri, Oct 17, 2008 at 12:20 PM, Kris Schneider [EMAIL PROTECTED] wrote: HashMap will