I. Why are synchronization containers present?
In the Java Collection Container framework, there are four main categories: list, Set, Queue, Map.
The List, Set, and queue interfaces inherit the collection interface respectively, and map itself is an interface.
Note that collection and map are a top-level interface, while list, set, and queue inherit the collection interface, which represents the three main classes of containers, arrays, sets, and queues.
Like ArrayList, LinkedList are implemented the list interface, HashSet implements the set interface, and Deque (two-way queue, allowing the team first, the team tail to join and out of the team) inherited the queue interface, Priorityqueue implements the queue interface. Another linkedlist (actually a doubly linked list) implements the Deque interface.
Containers such as ArrayList, LinkedList, and HashMap are non-thread-safe.
If there are multiple threads accessing these containers concurrently, the problem occurs.
Therefore, when you write a program, you must require programmers to manually synchronize with any access to those containers, which makes it extremely inconvenient to use these containers.
Therefore, Java provides a synchronization container for the user to use.
Two. Synchronization Container category Overview
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/87/23/wKioL1fVa-7xSFdoAACK_pg86ls986.png "title=" container. png "alt=" Wkiol1fva-7xsfdoaack_pg86ls986.png "/>
Three. Synchronous container source code detailed
Information reference: http://www.cnblogs.com/dolphin0520/category/602384.html
This list of links provides a detailed understanding of the implementation principles of some of the containers in the second.
This article is from the "Curiosity" blog, make sure to keep this source http://flash09.blog.51cto.com/8831225/1851784
java--Container Awareness