Correct unusual equals implementations

Found with FindBugs.
Avoid unnecessary boxing

Found with FindBugs.
Miscellaneous FindBugs fixes