MyCompare implements comparable and overrides the compareTo(Object o) method and can be sorted via Collections.sort()