Hello. i am coding a web service that processes a hashmap. I'm able to parse the map ok and use conditional ifs to determine what the current key is via string.equalsIgnoreCase(...).
However, I need to use a hashmap.get(key_name) for one operation and the key_name argument is case sensitive. Since this is a web service and i have no real control over how the consumers are sending the keys, i run a high risk of throwing a NullPointerException if the case of key_name uploaded by the consumer does not match the case of key_name in the service's get method.
is there anyway to make the HashMap.get method case insensitive. The only alternative i can think of is to scroll the entire hashmap in a mini- nested loop using conditional string.equalsIgnoreCase but that seems so redundant. Thank you very much for reading this.
[ August 07, 2008: Message edited by: Tom Griffith ]
However, I need to use a hashmap.get(key_name) for one operation and the key_name argument is case sensitive. Since this is a web service and i have no real control over how the consumers are sending the keys, i run a high risk of throwing a NullPointerException if the case of key_name uploaded by the consumer does not match the case of key_name in the service's get method.
is there anyway to make the HashMap.get method case insensitive. The only alternative i can think of is to scroll the entire hashmap in a mini- nested loop using conditional string.equalsIgnoreCase but that seems so redundant. Thank you very much for reading this.
[ August 07, 2008: Message edited by: Tom Griffith ]