Class LocaleComparator

  • All Implemented Interfaces:
    java.util.Comparator<java.lang.String>

    public class LocaleComparator
    extends CollatorComparator
    A comparator that sorts Strings using the locale's collator.
    • Constructor Summary

      Constructors 
      Constructor Description
      LocaleComparator()
      Default constructor uses the current locale's collator.
      LocaleComparator​(java.util.Locale locale)
      use a specific locale's collator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void setLocale​(java.util.Locale locale)
      Specify a new locale.
      • 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()
        Default constructor uses the current locale's collator.
      • LocaleComparator

        public LocaleComparator​(java.util.Locale locale)
        use a specific locale's collator.
    • Method Detail

      • setLocale

        public void setLocale​(java.util.Locale locale)
        Specify a new locale.
        Parameters:
        locale - the locale for future comparisons