1 19 20 package com.sslexplorer.boot; 21 22 import java.util.Comparator ; 23 import java.util.TreeMap ; 24 25 32 public class CaseInsensitiveMap extends TreeMap { 33 34 private static final long serialVersionUID = -963451042992843686L; 35 36 39 public CaseInsensitiveMap() { 40 super(new InsensitiveComparator()); 41 } 42 43 static class InsensitiveComparator implements Comparator { 44 public int compare(Object o1, Object o2) { 45 String s1 = (String )o1; 46 String s2 = (String )o2; 47 return s1.toUpperCase().compareTo(s2.toUpperCase()); 48 } 49 public boolean equals(Object o) { 50 return compare(this, o)==0; 51 } 52 } 53 54 } 55 | Popular Tags |