Package com.ibm.icu.impl
Class IterableComparator<T>
- java.lang.Object
-
- com.ibm.icu.impl.IterableComparator<T>
-
- All Implemented Interfaces:
Comparator<Iterable<T>>
public class IterableComparator<T> extends Object implements Comparator<Iterable<T>>
TODO: Move to com.ibm.icu.dev.somewhere. 2015-sep-03: Not used in ICU but used in CLDR and in UnicodeTools.
-
-
Constructor Summary
Constructors Constructor Description IterableComparator()IterableComparator(Comparator<T> comparator)IterableComparator(Comparator<T> comparator, boolean shorterFirst)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(Iterable<T> a, Iterable<T> b)Compares the two specified objects to determine their relative ordering.static <T> intcompareIterables(Iterable<T> a, Iterable<T> b)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals
-
-
-
-
Constructor Detail
-
IterableComparator
public IterableComparator()
-
IterableComparator
public IterableComparator(Comparator<T> comparator)
-
IterableComparator
public IterableComparator(Comparator<T> comparator, boolean shorterFirst)
-
-
Method Detail
-
compare
public int compare(Iterable<T> a, Iterable<T> b)
Description copied from interface:ComparatorCompares the two specified objects to determine their relative ordering. The ordering implied by the return value of this method for all possible pairs of(lhs, rhs)should form an equivalence relation. This means thatcompare(a,a)returns zero for alla- the sign of
compare(a,b)must be the opposite of the sign ofcompare(b,a)for all pairs of (a,b) - From
compare(a,b) > 0andcompare(b,c) > 0it must followcompare(a,c) > 0for all possible combinations of(a,b,c)
- Specified by:
comparein interfaceComparator<T>- Parameters:
a- anObject.b- a secondObjectto compare withlhs.- Returns:
- an integer < 0 if
lhsis less thanrhs, 0 if they are equal, and > 0 iflhsis greater thanrhs.
-
-