a. Compute an int hash code c for the field: i. If the field is a boolean, compute (f ? 1 : 0). ii. If the field is a byte, char, short, or int, compute (int) f. iii. If the field is a long, compute (int) (f ^ (f >>> 32)). iv. If the field is a float, compute Float.floatToIntBits(f). v. If the field is a double, compute Double.doubleToLongBits(f), and then hash the resulting long as in step 2.a.iii. vi. If the field is an object reference and this class's equals method compares the field by recursively invoking equals, recursively invoke hashCode on the field. If a more complex comparison is required,...
Note: hashcode
Constructors must not invoke overridable methods, directly or indirectly. If you violate this rule, program failure will result.
Note: ctor and overridable methods
If performance is of the essence, you don't mind keeping track of the decimal point yourself, and the quantities aren't too big, use int or long. If the quantities don't exceed nine decimal digits, you can use int; if they don't exceed eighteen digits, you can use long. If the quantities might exceed eighteen digits, you must use BigDecimal.
Note: desempenho com BigDecimal
One of the attributes that most strongly distinguishes expert programmers from less experienced ones is that experts strive for and usually achieve a high degree of code reuse.
Note: code reuse