java--Container Knowledge

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.