Reputation: 1075
I am working on a project (Java) and created an Object with a large number of variables. Since I am planning to add hashcode()
and equals()
. Is there a short cut in Eclipse to automatically generate hashcode()
and equals()
in a given class ?
Upvotes: 5
Views: 4686
Reputation: 3547
For Mac users: Command
+ N
(⌘N
)
IDE: Android Studio
[Source: https://www.jetbrains.com/help/idea/generating-code.html#generate-equals-hashcode ]
Upvotes: 1
Reputation: 1075
Ways to Generate hashcode() and equals() Method -
1) Press Alt + Shift + S + H
2) Right click -> Source -> Generate hashcode() and equals() Method
3) Go to Source menu -> Generate hashcode() and equals() Method
4) Go to Windows menu -> Preferences -> General -> Keys (Write Generate hashcode() and equals() Method on text field)
Upvotes: 4
Reputation: 12983
Another option is
Now, type "hash" and you can set command of your choice.
Some useful shortcuts are
Upvotes: 1
Reputation: 413
Is there a short cut in Eclipse to automatically generate hashcode() and equals() in a given class
Yes, Right click on the variable and source-> Generate hashcode() and equals().
Upvotes: 0