[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
vinayak shete wrote:@Jeanne Boyarsky : I have tried with @Override annotation. When I put @Override annotation getting compile time error :
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
That is a very effective way to make your hash map execute with all the speed and athleticism of a dying snail. Write a hashCode method that computes a hash code for each instance; Carey has already shown you a possible implementation. If you are using an immutable type as the “K” in your map (as you should anyway), you may be able to cache the hash code.vinayak shete wrote:. . . hashCode() method (will return same hash code - as 1 for each object.) . . .
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:If you comment out the @Override part, you indeed get other outcomes
Stephan van Hulst wrote:(...)
Can you clarify this? @Override doesn't affect the outcome of a program.
There are three kinds of actuaries: those who can count, and those who can't.