diff --git a/notes/Java 容器.md b/notes/Java 容器.md index 07cfed1a..f660fa59 100644 --- a/notes/Java 容器.md +++ b/notes/Java 容器.md @@ -1,8 +1,6 @@ * [一、概览](#一概览) - * [List](#list) - * [Set](#set) - * [Queue](#queue) + * [Collection](#collection) * [Map](#map) * [Java 1.0/1.1 容器](#java-1011-容器) * [二、容器中的设计模式](#二容器中的设计模式) @@ -23,17 +21,13 @@ # 一、概览 -

- 容器主要包括 Collection 和 Map 两种,Collection 又包含了 List、Set 以及 Queue。 -## List +## Collection -- ArrayList:基于动态数组实现,支持随机访问; +

-- LinkedList:基于双向循环链表实现,只能顺序访问,但是可以快速地在链表中间插入和删除元素。不仅如此,LinkedList 还可以用作栈、队列和双端队列。 - -## Set +### 1. Set - HashSet:基于 Hash 实现,支持快速查找,但是失去有序性; @@ -41,12 +35,22 @@ - LinkedHashSet:具有 HashSet 的查找效率,且内部使用链表维护元素的插入顺序,因此具有有序性。 -## Queue +### 2. List -只有两个实现:LinkedList 和 PriorityQueue,其中 LinkedList 支持双向队列,PriorityQueue 是基于堆结构实现。 +- ArrayList:基于动态数组实现,支持随机访问; + +- LinkedList:基于双向循环链表实现,只能顺序访问,但是可以快速地在链表中间插入和删除元素。不仅如此,LinkedList 还可以用作栈、队列和双端队列。 + +### 3. Queue + +- LinkedList:可以用它来支持双向队列; + +- PriorityQueue 是基于堆结构实现。 ## Map +

+ - HashMap:基于 Hash 实现。 - LinkedHashMap:使用链表来维护元素的顺序,顺序为插入顺序或者最近最少使用(LRU)顺序。 @@ -418,3 +422,4 @@ private V putForNullKey(V value) { # 五、参考资料 - Java 编程思想 +- [Java Collection Framework](https://www.w3resource.com/java-tutorial/java-collections.php) diff --git a/notes/Java 并发.md b/notes/Java 并发.md index cff33bb9..59813682 100644 --- a/notes/Java 并发.md +++ b/notes/Java 并发.md @@ -927,3 +927,4 @@ public static String concatString(String s1, String s2, String s3) { - [线程通信](http://ifeve.com/thread-signaling/#missed_signal) - [Java 线程面试题 Top 50](http://www.importnew.com/12773.html) - [BlockingQueue](http://tutorials.jenkov.com/java-util-concurrent/blockingqueue.html) +- [thread state java](https://stackoverflow.com/questions/11265289/thread-state-java) diff --git a/pics/java-collections.png b/pics/java-collections.png new file mode 100644 index 00000000..6a68af89 Binary files /dev/null and b/pics/java-collections.png differ diff --git a/pics/java-collections1.png b/pics/java-collections1.png new file mode 100644 index 00000000..852282ef Binary files /dev/null and b/pics/java-collections1.png differ