Question: For each of the following possible hashCode implementations: Is the following a legal hashCode method for a Point class, according to the general contract of

For each of the following possible hashCode implementations: Is the following a legal hashCode method for a Point class, according to the general contract of that method? Does it distribute the hash codes well between objects? Why or why not?

a. 

public int hashCode () { return x * y;

b.

public int hashCode () { return x * y;

c.

public int hashCode () { return x * y;

Step by Step Solution

3.45 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a This is a legal hashCode implementation according to the contract It distrib... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!