diff --git a/src/main/java/com/ossez/usreio/common/util/CaseInsensitiveComparator.java b/src/main/java/com/ossez/usreio/common/util/CaseInsensitiveComparator.java new file mode 100644 index 0000000..cf4a72d --- /dev/null +++ b/src/main/java/com/ossez/usreio/common/util/CaseInsensitiveComparator.java @@ -0,0 +1,12 @@ +package com.ossez.usreio.common.util; + +import java.io.Serializable; +import java.util.Comparator; + +public class CaseInsensitiveComparator implements Comparator, Serializable { + public int compare(Object o1, Object o2) { + String s1 = (String) o1; + String s2 = (String) o2; + return s1.compareToIgnoreCase(s2); + } +} diff --git a/src/main/java/com/ossez/usreio/common/util/CaseInsensitiveTreeMap.java b/src/main/java/com/ossez/usreio/common/util/CaseInsensitiveTreeMap.java new file mode 100644 index 0000000..2d1a10f --- /dev/null +++ b/src/main/java/com/ossez/usreio/common/util/CaseInsensitiveTreeMap.java @@ -0,0 +1,17 @@ +package com.ossez.usreio.common.util; + +import java.util.Map; +import java.util.TreeMap; + + +public class CaseInsensitiveTreeMap extends TreeMap { + public CaseInsensitiveTreeMap(Map map) { + this(); + this.putAll(map); + } + + public CaseInsensitiveTreeMap() { + super(new CaseInsensitiveComparator()); + } + +}