public static final class LocaleHelper.LocaleInfoComparator extends Object implements Comparator<LocaleStore.LocaleInfo>
It uses the label, leaving the decision on what to put there to the LocaleInfo. For instance fr-CA can be shown as "français" as a generic label in the language selection, or "français (Canada)" if it is a suggestion, or "Canada" in the country selection.
Gives priority to suggested locales (to sort them at the top).
Constructor and Description |
---|
LocaleInfoComparator(Locale sortLocale,
boolean countryMode)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(LocaleStore.LocaleInfo lhs,
LocaleStore.LocaleInfo rhs)
Compares its two arguments for order.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public LocaleInfoComparator(Locale sortLocale, boolean countryMode)
sortLocale
- the locale to be used for sorting.public int compare(LocaleStore.LocaleInfo lhs, LocaleStore.LocaleInfo rhs)
compare
in interface Comparator<LocaleStore.LocaleInfo>
lhs
- the first object to be comparedrhs
- the second object to be compared