先上一张图,从别的地方转过来的:
接口:最基本的接口是Collection,下面这些接口集成它:Set,List,SortedSet,NavigableSet,Queue,Deque,BlockingQueue和BlockingDeque。Map及其子类和Collection相对独立,它的子接口包括:SortedMap,NavigableMap,ConcurrentMapheConcurrentNavigableMap。
Collection Implementations
Classes that implement the collection interfaces typically have names of the form <Implementation-style><Interface>. The general purpose implementations are summarized in the table below:
Implementations | ||||||
---|---|---|---|---|---|---|
Hash Table | Resizable Array | Balanced Tree | Linked List | Hash Table + Linked List | ||
Interfaces | Set | HashSet | TreeSet | LinkedHashSet | ||
List | ArrayList | LinkedList | ||||
Deque | ArrayDeque | LinkedList | ||||
Map | HashMap | TreeMap | LinkedHashMap |
SortedMap:
当我们需要map中的key按照某种方式排序时,我们就需要用到SortedMap接口(TreeMap是该接口的一个实现类),比如说一个map的key是String,我们就可以直接构造一个TreeMap,这样map中的key就自动按照文本顺序来排序了,当然你也可以提供你自己的Comparator。
因为在Java Collection框架之前有两个旧类,Vector和HashTable,虽然它们现在也已经实现了相应的接口,但是经常拿来和它们的对照类ArrayList/HashMap作比较。
直接拷贝:http://www.cnblogs.com/eflylab/archive/2007/01/20/625237.html里的总结
“ArrayList和Vector的区别。
一.同步性:Vector是线程安全的,也就是说是同步的,而ArrayList是线程序不安全的,不是同步的
二.数据增长:当需要增长时,Vector默认增长为原来一培,而ArrayList却是原来的一半
HashMap和Hashtable的区别
一.历史原因:Hashtable是基于陈旧的Dictionary类的,HashMap是Java 1.2引进的Map接口的一个实现
二.同步性:Hashtable是线程安全的,也就是说是同步的,而HashMap是线程序不安全的,不是同步的
三.值:只有HashMap可以让你将空值作为一个表的条目的key或value ”