compareTo returns 0 when strings are equal, something else when they are not. So you can use it to do the job of equals()
if ( a.equals( b ) )
if ( a.compareTo( b ) == 0 )
Besides being less typing and maybe some insignificant bit quicker, equals() communicates better that we're just checking for equality.
You may find some custom classes outside the
Java library that correctly implement one of these but not the other. For example, I just implemented compareTo on some classes that I wanted to put in a TreeSet, but didn't implement equals(). That could surely come back to bite me!