
cn.jiangzeyin.util.KeyMap Maven / Gradle / Ivy
package cn.jiangzeyin.util;
import java.util.*;
/**
* 不区分大小写
* Created by jiangzeyin on 2017/8/15.
*
* @author jiangzeyin
*/
public class KeyMap {
private Map map;
public KeyMap(Map map) {
Objects.requireNonNull(map);
this.map = map;
Set> entries = this.map.entrySet();
Iterator> iterator = entries.iterator();
Map temp = new HashMap<>();
while (iterator.hasNext()) {
Map.Entry entry = iterator.next();
String key = entry.getKey().toString();
String newKey = key.toLowerCase();
temp.put((K) newKey, entry.getValue());
iterator.remove();
}
this.map.clear();
this.map.putAll(temp);
}
public V get(K k) {
return map.get(k);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy