Keys in the java. util. HashMap are case sensitive. It means you can have both “abc” and “ABC” as keys in the same map.
There are many way around for this issue , but in Spring Utils we already have a LinkedCaseInsensitiveMap for case insensitive keys.
public static void main(String args[]) {
Map<String, Object> customized=new LinkedCaseInsensitiveMap<Object>();;
customized.put("HELLO1", "Hello,how do you do?");
Map<String, Object> customized2=new HashMap<String,Object>();;
customized.put("HELLO1", "Hello,how do you do?");
System.out.println("Case sensitive "+customized2.get("hello1"));
System.out.println("Case Insensitive "+customized.get("hello1"));
}
o/p of the above —
Case sensitive null
Case Insensitive Hello,how do you do?