Question Nineth (set set)

Source: Internet
Author: User


First, set set

The set collection stores the elements that are not duplicates.

The following interfaces are included in the collection frame

Collection (ancestor), Set (son SortedSet, grandson Navigableset), List,queue (son deque)

The other is abstract classes (abstract classes are named with abstract) and concrete classes

Interface: A structure similar to a class that contains only constants and abstract methods. Interfaces are very similar to abstract classes in many ways, but their purpose is to indicate the common behavior of multiple objects.

Interfaces are used to define, not to instantiate. C Error

Next look at the set implementation class, Hashset,linkedhashset,treeset

HashSet, a basic implementation of the set interface, is implemented in collection defined methods, such as Add,size,remove,iterator,contains,toarray, etc.

Linkedhashset, which implements an extension of the HashSet class with a list, supports ordering elements within the ruleset, sorted by order of insertion, imposing a different order (ascending or descending), which can be used with TreeSet. For the subject, it is obvious that the output will be [2,1]

TreeSet, supports sorting. This is obviously right.

But when I run, A, B is all right. (A, B are right, of course only for this problem)

Now that there's a sortedlist, revisit the list.

Second, linear table

Linear tables not only store duplicate elements, but also allow the user to specify their storage location.

Interface List (ancestor collection)

Implementing classes ArrayList and LinkedList

Why not SortedList?

Consult API discovery, no it exists!!! It's the "agents" in C # and VB.

(Perhaps I did not find, if someone found in Java exists, please also inform, thank you!!! )



Question Nineth (set set)

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.