- public static final Comparator CASE_INSENSITIVE_ORDER = new Comparator()
- {
- public int compare (Object o1, Object o2)
+ /**
+ * An implementation for {@link CASE_INSENSITIVE_ORDER}.
+ * This must be {@link Serializable}.
+ */
+ private static final class CaseInsensitiveComparator
+ implements Comparator, Serializable
+ {
+ /**
+ * The default private constructor generates unnecessary overhead
+ */
+ CaseInsensitiveComparator() {}
+
+ /**
+ * Compares two Strings, using
+ * <code>String.compareToIgnoreCase(String)</code>.
+ *
+ * @param o1 the first string
+ * @param o2 the second string
+ * @return < 0, 0, or > 0 depending on the case-insensitive
+ * comparison of the two strings.
+ * @throws NullPointerException if either argument is null
+ * @throws ClassCastException if either argument is not a String
+ * @see #compareToIgnoreCase(String)
+ */
+ public int compare(Object o1, Object o2)