An enum in Java implements the Comparable
interface. It would have been nice to override Comparable
\'s compareTo
method, but here it\
One possible explanation is that compareTo
should be consistent with equals
.
And equals
for enums should be consistent with identity equality (==
).
If compareTo
where to be non-final it would be possible to override it with a behaviour which was not consistent with equals
, which would be very counter-intuitive.