As said before the line, the natural order is case sensitive. But, if you want unobtrusive ordering, you can provide a comparator as a parameter to the TreeMap constructor:
Map<String, Integer> m = new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER);
ps Please note that when using random letter orders, keys will also compare immodest:
m.put("Hello", 1); m.put("helLo", 6);
The result is 6, and the Hello key
D0dger
source share