Class LocaleComparator

  • All Implemented Interfaces:
    java.util.Comparator<java.util.Locale>

    public class LocaleComparator
    extends java.lang.Object
    implements java.util.Comparator<java.util.Locale>
    The class LocaleComparator compares Locale objects. This Comparator does not check null, for null check you can decorate it with the NullCheckComparator.of(Comparator). an example is in the unit test class from NullCheckComparator.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.util.Locale o1, java.util.Locale o2)
      static java.util.Comparator<java.util.Locale> of()
      Factory method to create a new LocaleComparator object.
      static java.util.Comparator<java.util.Locale> of​(boolean nullIsGreaterThan)
      Factory method to create a new LocaleComparator object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • LocaleComparator

        public LocaleComparator()
    • Method Detail

      • of

        public static java.util.Comparator<java.util.Locale> of()
        Factory method to create a new LocaleComparator object.
        Returns:
        the new LocaleComparator object
      • of

        public static java.util.Comparator<java.util.Locale> of​(boolean nullIsGreaterThan)
        Factory method to create a new LocaleComparator object.
        Parameters:
        nullIsGreaterThan - the flag that specifies if null objects is greater than non null objects.
        Returns:
        the new LocaleComparator object
      • compare

        public int compare​(java.util.Locale o1,
                           java.util.Locale o2)
        Specified by:
        compare in interface java.util.Comparator<java.util.Locale>