GCI-9: Add matching equals() method to compareTo() methods and use Integer.valueOf instead of constructor

All tests passed.