Class BrowseTermComparator

java.lang.Object
io.goobi.viewer.model.termbrowsing.BrowseTermComparator
All Implemented Interfaces:
Serializable, Comparator<BrowseTerm>

public class BrowseTermComparator extends Object implements Comparator<BrowseTerm>, Serializable
Custom string comparator for browsing terms (case-insensitive, ignores brackets, natural sorting).
See Also:
  • Constructor Details

    • BrowseTermComparator

      public BrowseTermComparator(Locale locale)
  • Method Details

    • compare

      public int compare(BrowseTerm o1, BrowseTerm o2)
      Specified by:
      compare in interface Comparator<BrowseTerm>
      Parameters:
      o1 - first browse term to compare
      o2 - second browse term to compare
      Returns:
      a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
    • normalizeString

      public static String normalizeString(String str, String ignoreChars)
      Parameters:
      str - String to normalize
      ignoreChars - Optional string containing leading characters to remove from the string
      Returns:
      Cleaned-up string for comparison