继续概述Map实现类
Provider
RenderingHints
SimpleBindings
TabularDataSupport
TreeMap
UIDefaults
WeakHashMap
RenderingHints
SimpleBindings
TabularDataSupport
TreeMap
UIDefaults
WeakHashMap
Provider
标签:SPI
概述:自定义一组加密服务商,来与java.security交互,是一中插拔方便的工具
RenderingHints
标签:awt 绘制
概述:提供了java在awt绘制上的多重参数配置和选择
SimpleBindings
标签:非线程安全 Hashmap
概述:所有的K都是string,默认构造会建立一个HashMap<String,Object> 有一个专门验证key的方法,见一下摘选源码。
private void checkKey(Object key) {
if (key == null) {
throw new NullPointerException("key can not be null");
}
if (!(key instanceof String)) {
throw new ClassCastException("key should be a String");
}
if (key.equals("")) {
throw new IllegalArgumentException("key can not be empty");
}
}
public void putAll(Map<? extends String, ? extends Object> toMerge) {
if (toMerge == null) {
throw new NullPointerException("toMerge map is null");
}
for (Map.Entry<? extends String, ? extends Object> entry : toMerge.entrySet()) {
String key = entry.getKey();
checkKey(key);
put(key, entry.getValue());
}
}
public Object put(String name, Object value) {
checkKey(name);
return map.put(name,value);
}
TabularDataSupport
标签: 远程调用 MBean
概述:提供远程调用类型映射使用,开放数据类型openBean包下
TreeMap
标签:非线程安全 红黑树结构实现
概述:默认key升序排序,也可以根据我们要求进行排序,中文按拼音排序,英文按字母
public static void main(String[] args) throws OpenDataException {
TreeMap<Integer, Integer> tm = new TreeMap<>(new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o1 < o2 ? 1 : ( o1 > 02 ? -1 : 0 );
}
});
tm.put(1, 10);
tm.put(2, 100);
tm.put(4, 10000);
tm.put(5, 100000);
tm.put(3, 1000);
tm.put(6, 1000000);
tm.forEach((k, v) -> System.out.println("k -> " + k + "~ v -> " + v));
}
public static void main(String[] args) throws OpenDataException {
TreeMap<String, Integer> tm = new TreeMap<>();
tm.put("A", 10);
tm.put("a", 100);
tm.put("在", 10000);
tm.put("6", 100000);
tm.put("*", 1000);
tm.put("f", 1000000);
tm.put("啊啊啊", 10000);
tm.forEach((k, v) -> System.out.println("k -> " + k + "~ v -> " + v));
}
k -> *~ v -> 1000
k -> 6~ v -> 100000
k -> A~ v -> 10
k -> a~ v -> 100
k -> f~ v -> 1000000
k -> 啊啊啊~ v -> 10000
k -> 在~ v -> 10000
UIManager
标签:swing 属性
概述:获取/写入swing组件属性
WeakHashMap
标签:非线程安全 弱引用 HashMap
连接:请参见 浅读java.util.Map及其实现类(五)WeakHashMap专题