...
Any objects that are compared, or stored in any hash based data structure (e.g. HashSet, HashMap), should implement these methods. For objects that implement them, comparisons should use theirĀ equals()
method, and not ==
. An exception to this rule are Enums.
Variables and Parameters
Final keyword
Variables and parameters should not be gratuitously decorated There is no need to decorate variables and parameters with the final
keyword. This is an out-dated convention from Java 1.1 era. The only time this is required is when the parameter is used as part of an anonymous class closure defines within the method. Otherwise, let the Java compiler/optimizer to its work.
...