org.carrot2.text.util
Class CharArrayComparators

java.lang.Object
  extended by org.carrot2.text.util.CharArrayComparators

public class CharArrayComparators
extends Object

A set of specific comparators for char [] arrays.


Field Summary
static Comparator<char[]> CASE_INSENSITIVE_CHAR_ARRAY_COMPARATOR
          A case-insensitive lexicographic comparator.
static Comparator<char[]> FAST_CHAR_ARRAY_COMPARATOR
          A case-sensitive lexicographic comparator.
static Comparator<char[]> NORMALIZING_CHAR_ARRAY_COMPARATOR
          A comparator that groups different strings into different buckets (case-insensitive) and strings within these buckets (case-sensitive).
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CASE_INSENSITIVE_CHAR_ARRAY_COMPARATOR

public static final Comparator<char[]> CASE_INSENSITIVE_CHAR_ARRAY_COMPARATOR
A case-insensitive lexicographic comparator.


FAST_CHAR_ARRAY_COMPARATOR

public static final Comparator<char[]> FAST_CHAR_ARRAY_COMPARATOR
A case-sensitive lexicographic comparator.


NORMALIZING_CHAR_ARRAY_COMPARATOR

public static final Comparator<char[]> NORMALIZING_CHAR_ARRAY_COMPARATOR
A comparator that groups different strings into different buckets (case-insensitive) and strings within these buckets (case-sensitive). The comparator that applies the following rules in the following order:
  1. A null string is greater than a non-null one
  2. A longer string is greater
  3. Strings are first compared in case-insensitive mode
  4. Finally, strings are compared in case-sensitive mode
This comparator does not provide a lexicographic order, which makes it much faster, but not suitable for general purpose sorting.



Copyright (c) Dawid Weiss, Stanislaw Osinski