Set of the collection interface

Source: Internet
Author: User

The set interface and its implementation class HashSet:

  • The set interface is a sub-interface of the collection interface.
  • Set is an unordered and non-repeatable set of elements
  • HashSet (hash set): Is an important implementation class of Set
  • Set inherits the method of adding and removing from the collection interface, but it does not have a set method because the data he stored is unordered, so it cannot be given an index to modify the value of the index.
  • Data traversal in set can only be traversed with a for each or an iterator. (Because the data it stores is unordered)
  • The data in set is not repeatable, no matter how many times it is added, eventually only one reference to that object is retained, and the last one added is retained.
  • Set can add empty object null.

Set of the collection interface

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.