Class CollatorHelper

java.lang.Object
com.helger.commons.compare.CollatorHelper

@ThreadSafe public final class CollatorHelper extends Object
Helper class to easily create commonly used Collator objects.
Author:
Philip Helger
  • Method Details

    • getCollatorSpaceBeforeDot

      @Nonnull @ReturnsMutableCopy public static Collator getCollatorSpaceBeforeDot(@Nullable Locale aLocale)
      Create a collator that is based on the standard collator but sorts spaces before dots, because spaces are more important word separators than dots. Another example is the correct sorting of things like "1.1 a" vs. "1.1.1 b" . This is the default collator used for sorting by default!
      Parameters:
      aLocale - The locale for which the collator is to be retrieved. May be null to indicate the usage of the default locale.
      Returns:
      The created RuleBasedCollator and never null.
    • clearCache

      @Nonnull public static EChange clearCache()
      Clear all cached collators.
      Returns:
      EChange