Features and usage of MAP, Set, List, Queue, stack

Source: Internet
Author: User

Map

1, key-value pairs of objects, a mapping can not include duplicate keys;

2, some mapping implementation can ensure the order , such as TreeMap class;

3, other mappings can not guarantee the order, such as HashMap class;

4, KeySet () extract key sequence;

5. All keys in the map generate a set, not duplicates ;

6. Values () extracts the value sequence;

7, all values in the map generate a collection;

List

1, can randomly access The elements contained, the elements are ordered ;

2, can be in any position to add, delete elements;

3, no matter how many times, the element position is unchanged ;

4, allow repeating elements;

5, using Iterator to realize unidirectional traversal;

6, using listiterator to realize bidirectional traversal;

Queue

1, first-out;

2, with offer () to add elements;

3, using poll () to obtain the removal of elements;

4, using Element () or peek () to obtain the front-end elements;

Stack

1, last in first out ;

2, inheriting vectors, thread synchronization , that is, thread-safe;

3, using push, pop, peek, empty, search and other methods;

Set

1. Collection containing non-repeating elements ;

2, set does not contain o1.equals (O2) elements;

3, the O1 and O2 contain a maximum of a null element;

4, can not randomly access the elements contained;

5, can only use iterator to achieve one-way traversal;

6, Set no synchronization method;

Features and usage of MAP, Set, List, Queue, stack

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.