public class StringComparator implements TreeComparator { @Override public int compare(String a, String b) { int comparing = a.compareTo(b); if (comparing == 0) return 0; return comparing /= Math.abs(comparing); } }