Eclipse Tip: Generate hashCode and equals methods

Previously I had mentioned about generating getters and setters in Eclipse. Another set of methods which are commonly used (or not) are the ‘equals( Object obj )‘ and ‘hashCode()‘ methods. Eclipse can generate them for you.

Just right click on the editor and go to Source>Generate hashCode() and equals()… The above dialog pops up and lets you choose the fields you want to be included in these methods. Just select the ones you need and press OK. You now have the methods generated.

This is simple feature but is a time saver.

8 thoughts on “Eclipse Tip: Generate hashCode and equals methods”

  1. Interesting Vista theme. Must be a perforamnce sapper though…isnt it? I see a bit of transparency up in the top of the titlebar….

  2. Yeah, such themes are available for dwnload. One of my friends, billoo, uses vista theme in Ubuntu Linux. His status bar and taskbar is transparent. These themes are cool but just for appearance. they don’t enhance performance or anything.

  3. Though the RSS integration is not great, yet it is far better than that available in firefox 1.5 ( the current stable version). The history menu, previously unavailable in ver1.5 seems to be a very welcome tool. But the best of the package is the built in antiphishing tool that is being developed with the help of Google.

Comments are closed.