一、hashMap 与 HashTable 的区别
1、主要:
Hashtable线程安全,同步,效率低下
HashMap线程不安全,不同步,效率高
2、父类:
Hashtable 是Dictionary HashMap是AbstractMap
3、null:
Hashtable键与值不能为null
HashMap键最多一个null,值可以有多个null
二、Properties
1、作用:读写资源配置文件
2、键值只能为字符串
3、方法
setProperty(String key,String value)
getProperty(String key)
getProperty(String key,String defaultValue)
后缀
.properties
store(OutputStream out,String comments)
store(Writer writer,String comments)
.xml
storeToXML(OutputStream os,String comment) 默认:UTF-8 字符集
storeToXML(OutputStream os,String comment ,String encoding)
load(InputStream inStream)
load(Reader reader)
loadFromXNL(InputStream in)