Last time, when our team reviewed my code, they pointed several problems of my code. I'm really happy to learn from them. Until now, what I do is only to make the code work. Then, I'll try to refactor it as well as I can. The lack of comprehensive knowledge in Java blocks me to write effective and clean code. After that, I start learning Java again to know more effective way.
I started learning from http://www.javapractices.com. This is a good website to learn Java.
Today I take a look at compareTo, equals and hashcode. Because one of our project need to use Object as key, I only override compareTo, I didn't know we still need to override equals. And when we override equals, we need to override hashcode. After I take a look at those three concepts, I know clearly about it.
Here is the references of them:
CompareTo: http://www.javapractices.com/topic/TopicAction.do;jsessionid=A5F619613C75E732660049F98FB09B13?Id=10
equals: http://www.javapractices.com/topic/TopicAction.do;jsessionid=A5F619613C75E732660049F98FB09B13?Id=17
hashcode: http://www.javapractices.com/topic/TopicAction.do;jsessionid=A5F619613C75E732660049F98FB09B13?Id=28