Java-Collection Frame Finishing

Source: Internet
Author: User

A. List Interface collection:

1, advantages and characteristics: orderly, allow repeating elements.

2. Implementation class:

* Aarraylist class: Asynchronous, variable-length array, multiplication rate is 1/n;

* LinkedList class: Not synchronized, linked list structure, adding and deleting fast.

* Vector Class (the elder, not currently used): synchronous, variable length, multiplied by 1 time times.

Second, set interface set:

1, advantages and Features: unordered collection, do not allow repeating elements.

2. Implementation class:

* HashSet class: No synchronization, hash table, unordered, based on the hash value of the deposit element, in addition, can be based on a number of fields to establish their own unique hash value code, the replication Equals method;

* TreeSet class: Out-of-sync, tree-like structure, can be the natural sort of objects;

For example: Judging the sorting order compares the hash value of age and name, int temp = This.age-p.age; return temp = 0? This.name.CompareTo (p.name): temp;

Note: The study is shallow, the unknown place please understand!

Author: Rick-bao

Java-Collection Frame Finishing

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.