bb.util
Class LocaleTimeZoneUtil.LocaleComparator
java.lang.Object
bb.util.LocaleTimeZoneUtil.LocaleComparator
- All Implemented Interfaces:
- Serializable, Comparator<Locale>
- Enclosing class:
- LocaleTimeZoneUtil
public static class LocaleTimeZoneUtil.LocaleComparator
- extends Object
- implements Comparator<Locale>, Serializable
Imposes an ordering on Locales that is consistent with equals; see compare
for details.
This class is multithread safe: it is immutable (both its immediate state, as well as the deep state of its fields).
- See Also:
- Serialized Form
Method Summary |
int |
compare(Locale l1,
Locale l2)
Tries to order l1 and l2 by their names:
returns l1. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
LocaleTimeZoneUtil.LocaleComparator
public LocaleTimeZoneUtil.LocaleComparator()
compare
public int compare(Locale l1,
Locale l2)
throws IllegalArgumentException,
IllegalStateException
- Tries to order l1 and l2 by their names:
returns
l1.Locale.getDisplayName()
.compareTo( l2.getDisplayName() )
if that result is != 0.
Else returns 0 if l1.equals
(l2)
is true.
This is the only circumstance in which 0 will ever be returned, thus,
this Comparator is consistent with equals (see Comparator
for more discussion).
Else throws an IllegalStateException.
- Specified by:
compare
in interface Comparator<Locale>
- Throws:
IllegalArgumentException
- if l1 or l2 is null
IllegalStateException
- if run out of criteria to order l1 and l2