List, set, map, listsetmap

Source: Internet
Author: User

List, set, map, listsetmap

List, Set inheritance and Collection interfaces; map has no explicit inheritance class;

The List interface has three implementation classes: rule List, ArrayList, and Vector.

Hierarchical list: the underlying layer is implemented based on the linked list. Each element stores its own memory address and the address of the next element. Fast addition and deletion of linked lists, slow Query

The difference between ArrayList and Vector: ArrayList is non-thread-safe and efficient. Vector is thread-safe and inefficient.

The Set interface has two implementation classes: HashSet (implemented by HashMap at the underlying layer) and LinkedHashSet

The Map interface has three implementation classes: HashMap, HashTable, and LinkeHashMap.

HashMap is non-thread safe, efficient, and supports null; HashTable is thread safe, inefficient, and does not support null

Differences:

List features: elements are ordered and repeatable

Set features: unordered elements, not repeated

Map features: Key-value pairs of elements are stored without putting in order

 

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.