Impossibly, java does not give you operator overloading.
But more OO options is to add a method inside a person
public boolean isTallerThan(Person anotherPerson){ return this.compareTo(anotherPerson) > 0; }
so instead of writing
if(personA.compareTo(personB) > 0){ }
You can write
if(personA.isTallerThan(personB)){ }
IMHO is more readable because it hides the details and is expressed in the domain language, and not in java-specific.
Pablo grisafi
source share