JAVA8 Source-set Overall Architecture __java

Source: Internet
Author: User

For a while, we've learned and summed up the list and map implementation classes. Next, we start to learn set. I believe that after learning map, it will be much easier to learn set. This article mainly introduces the whole structure of set. The overall structure of the set

The set interface inherits the collection interface. Feature is not to save duplicate elements.

Abstractset

is an abstract class that inherits from Abstractcollection and implements set. Abstractcollection provides the backbone implementation of the set interface, minimizing the work required to implement this interface.

SortedSet

Further provides a set for the overall ordering of elements. These elements are sorted by their natural order, or by the comparator that are usually provided when an ordered set is created. The set iterator iterates through the set in ascending order of elements. Provides some additional actions to take advantage of this sort.

Navigableset

Extended SortedSet with a navigation method that reports the closest match for a given search target.

HashSet

Relying on the implementation of a hash table is actually a HashMap instance. It does not guarantee the iteration order of the set, especially it does not guarantee that the order is immutable. This class allows null elements to be used.

TreeSet

Navigableset implementation based on TreeMap. The elements are sorted using the natural order of the elements, or sorted according to the comparator provided when the set was created, depending on the constructor method used.

Linkedhashset

hash table and link list implementations of set interfaces with predictable iterative order. Inherits HashSet, has the HashSet query speed, maintains a double link list running on all entries. This list of links defines the sequence of iterations, that is, the order in which elements are inserted into the set (the insertion order). Note that the insertion order is not affected by elements that are reinserted in the set. The order of the element insertion is displayed.

This article has been included in the JAVA8 container source code notes column.

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.