USRE-87 Add two new class for common util
This commit is contained in:
parent
c904d1953c
commit
2dce8dfc7c
|
@ -0,0 +1,12 @@
|
|||
package com.ossez.usreio.common.util;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class CaseInsensitiveComparator<T> implements Comparator<T>, Serializable {
|
||||
public int compare(Object o1, Object o2) {
|
||||
String s1 = (String) o1;
|
||||
String s2 = (String) o2;
|
||||
return s1.compareToIgnoreCase(s2);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ossez.usreio.common.util;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
||||
public class CaseInsensitiveTreeMap<K, V> extends TreeMap<K, V> {
|
||||
public CaseInsensitiveTreeMap(Map<K, V> map) {
|
||||
this();
|
||||
this.putAll(map);
|
||||
}
|
||||
|
||||
public CaseInsensitiveTreeMap() {
|
||||
super(new CaseInsensitiveComparator());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue