fix various findbugs errors categorized CORRECTNESS and BAD_PRACTICE

**please review**
if you read the title of this pull request, you will see that I ran the tool through findbugs, which is a static analysis tool designed to detect bugs and antipatterns. In this case, these classes implemented Comparable. The contract of Comparable is that it provides a total ordering consistent with equals and hashCode. i.e., if `o1.compareTo(o2) == 0`, then `o1.equals(o2)`, and if `o1.compareTo(o2) != 0`, then `!o1.equals(o2)`

It's bugs like this that lead us into situations where we have to spend long effort migrating from one JVM to another, because we have disobeyed the contract of the Java language.