Java Review 1

Source: Internet
Author: User

HashSet is the inherited set interface, and set implements the collection interface.

In Java programming, how do you tell if two objects in a Java collection are equal? It is broadly divided into two steps:

1. First determine whether the hashcode of two objects is equal

If not equal, two objects are not equal;

If they are equal, proceed to the next step, 2

2. Use the Equals () method to determine two objects

If not equal, the two objects are also considered unequal;

If equal, two objects are determined to be equal.

Note: the Equals () method determines whether two objects are equal, compares the possible addresses of two objects, and may compare the contents of two objects. This can be referred to this address: http://www.iteye.com/topic/257191

Java Review 1

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.