Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
There are many classes with instance fields that could be made final.
Two in particular seem like ideal candidates:
Complex - fields: real, imaginary
Fraction - fields: numerator, denominator (the private reduce() method also needs to be inlined)
As far as I can tell, making the above changes makes the classes immutable and therefore threadsafe.