change API to use equals() instead of compareTo()