Vector(AbstractList子类)、Stack(Vector子类)线程安全
ArrayList、LinkedList(实现了Queue接口)不是线程安全
Hashtable线程安全 HashMap线程不安全
Hashset内部用Map.Entry实现,线程不安全
StringBuffer线程安全 StringBuilder效率高
HashMap和Hashtable都实现了Map接口,区别:
HashMap中存的Hash值是重新对key的hashcode按位运算计算的,而HashTable中存的Hash值是key的hashcode取模计算
HashMap键值都可为null,HashTable键值都不可为null
HashMap使用Iterator,Hashtable即可使用Iterator也可使用Enumeration
Map map2 = Collections.synchronizedMap(new HashMap());
得到线程安全的SynchronizedMap,是Collections的内部类