Differences between list, set, and map

Source: Internet
Author: User

The list dynamic set interface can dynamically add elements. It is convenient to use the itractor iterator to traverse collection elements;
Map is a set of key-value pairs. The advantage is that you can find the corresponding value through the corresponding key, just like opening a lock with a key;
Set is also a set. The relationship between adjacent two elements is convenient to search for adjacent set elements horizontally;

 

The list iterative access will be displayed in the order you add (ADD! Hashset is the most common option for adding duplicate elements. duplicate elements cannot be added. During iterative output, the unordered map is not the same as the above two, it stores key-value pairs

 

List and set are under the collection interface, while map is also an interface. Although they are all sets, the underlying principle is quite different!

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.