Set of explanations

Source: Internet
Author: User

Set Set

Common methods:

1, int size (): Returns the number of elements in the set

2. Boolean isEmpty (): Returns True if no element is included

3, contains (Object O): Returns True if the specified element is included

4. Boolean Add (Object O): If the specified element does not exist, then add to the set

5. Void Clear (): Remove all elements from set

6. Boolean RemoveAll (Collection C): If the set contains the specified collection, remove all elements from the set that make the collection

Implementation class:

HashSet: There is no relationship between the order in which elements are stored and the order in which they are added

Linkedhashset: Preserving the order in which elements are added

TreeSet: Sort the elements in a set

###########################################################################################

List Collection

Common methods:

1. public void Add (E Element)

2. public void Add (int index,eelement)

3. public void AddAll (E element)

4. public void AddAll (Intindex,collection c)

Implementation class:

ArrayList: Asynchronous processing with high performance and non-thread-safe

Vector: Synchronous processing, low performance, thread safety


This article is from the "Zero Technology Road" blog, please be sure to keep this source http://zerohou.blog.51cto.com/3019528/1615018

Set of explanations

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.