StringComparatorABC implements Comparator<String>, Serializable { @Nonnull public static StringComparatorABC getInstance() { return INSTANCE; } private  StringComparatorABC(); @Nonnull static StringComparatorABC getInstance(); @Override int compare(@Nonnull final String a, @Nonnull final String b);  }
@Test public void testSorting() { final List<String> list = Arrays.asList("b", "c", "1", "hello", "ABC", "A"); Collections.sort(list, StringComparatorABC.getInstance()); assertArrayEquals(new String[]{"1", "A", "ABC", "b", "c", "hello"}, list.toArray()); }