AlphabeticalCaseInsensitiveCharSequenceComparator implements Comparator<CharSequence> { @Override public int compare(CharSequence charSequence1, CharSequence charSequence2) { return charSequence1.toString().compareToIgnoreCase(charSequence2.toString()); }  @Override int compare(CharSequence charSequence1, CharSequence charSequence2);  }
@Test public void compare() { final AlphabeticalCaseInsensitiveCharSequenceComparator comparator = new AlphabeticalCaseInsensitiveCharSequenceComparator(); final String string1 = "abcde"; final String string2 = "wxyz"; assertTrue(comparator.compare(string1, string1) == 0); assertTrue(comparator.compare(string2, string2) == 0); assertTrue(comparator.compare(string1, string2) < 0); assertTrue(comparator.compare(string2, string1) > 0); }