cn.hutool.core.map.CaseInsensitiveTreeMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hutool-all Show documentation
Show all versions of hutool-all Show documentation
Hutool是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,提高工作效率,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。
package cn.hutool.core.map;
import java.util.Comparator;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
/**
* 忽略大小写的{@link TreeMap}
* 对KEY忽略大小写,get("Value")和get("value")获得的值相同,put进入的值也会被覆盖
*
* @author Looly
*
* @param 键类型
* @param 值类型
* @since 3.3.1
*/
public class CaseInsensitiveTreeMap extends CaseInsensitiveMap {
private static final long serialVersionUID = 4043263744224569870L;
// ------------------------------------------------------------------------- Constructor start
/**
* 构造
*/
public CaseInsensitiveTreeMap() {
this((Comparator super K>) null);
}
/**
* 构造
*
* @param m Map
* @since 3.1.2
*/
public CaseInsensitiveTreeMap(Map extends K, ? extends V> m) {
this();
this.putAll(m);
}
/**
* 构造
*
* @param m Map,初始Map,键值对会被复制到新的TreeMap中
* @since 3.1.2
*/
public CaseInsensitiveTreeMap(SortedMap extends K, ? extends V> m) {
super(new TreeMap(m));
}
/**
* 构造
*
* @param comparator 比较器,{@code null}表示使用默认比较器
*/
public CaseInsensitiveTreeMap(Comparator super K> comparator) {
super(new TreeMap<>(comparator));
}
// ------------------------------------------------------------------------- Constructor end
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy