<p> THAT'S OK: ${((Map<String,Integer>)view.get("upgrade_assignment_type_map")).toString()} </p>
<p> THAT'S ALSO OK:
for( String _name : ((Map<String, Integer>)view.get("upgrade_assignment_type_map")).keySet() ) {
<p> ${_name}: ${((Map<String, Integer>)view.get("upgrade_assignment_type_map")).get(_name)} </p>
}
</p>
<br><br>
<p> SADLY THAT'S NOT OK::: ${((Map<String, Integer>)view.get("upgrade_assignment_type_map")).get("MANUAL")} </p>
The above code segment prints following output which is surprising for me:
THAT'S OK: {AUTO_WITH_BALANCE_EMPHASIS=2, AUTO_WITH_OFFENSIVE_EMPHASIS=0, MANUAL=3, AUTO_WITH_DEFENSIVE_EMPHASIS=1}
THAT'S ALSO OK:
AUTO_WITH_BALANCE_EMPHASIS: 2
AUTO_WITH_OFFENSIVE_EMPHASIS: 0
MANUAL: 3
AUTO_WITH_DEFENSIVE_EMPHASIS: 1
SADLY THAT'S NOT OK:::
The last line of code segment tries to get the value of key "MANUAL" but it's not printing the value and if I try to convert it to toString (like ${((Map<String, Integer>)view.get("upgrade_assignment_type_map")).get("MANUAL").toString()}
) it gives me null at runtime. I don't understand why it's happening?
and when I print the length(after first colon <p> ${_name}: ${_name.length()} : ${((Map<String, Integer>)view.get("upgrade_assignment_type_map")).get(_name)} </p>
) of each key I got:
AUTO_WITH_BALANCE_EMPHASIS: 29 : 2
AUTO_WITH_OFFENSIVE_EMPHASIS: 29 : 0
MANUAL: 10 : 3
AUTO_WITH_DEFENSIVE_EMPHASIS: 30 : 1
Note: I am creating map inside java source as Map<String, Integer> nameToTypeMap = Maps.newHashMap();
Eclipse was not showing invalid characters and there were invalid characters (which were surprisingly compilable) in those string, so when I opened that particular file in vim, it shows me and I removed those invalid characters. That solves my problem.