|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.molae.pipe.sorted.ComparatorUtil
public final class ComparatorUtil
Utility methods for Comparators.
| Method Summary | ||
|---|---|---|
static boolean |
areEqual(Object o1,
Object o2)
Checks the specified objects for equality. |
|
static
|
compare(T o1,
T o2,
Comparator<T> c)
Compares two objects using the specified comparator. |
|
static
|
isSorted(Iterator<T> it,
Comparator<? super T> comparator)
Checks if the specified iterator is in sorted order of the specified comparator. |
|
static
|
max(T o1,
T o2)
Compares the two specified objects and returns the greater one. |
|
static
|
max(T o1,
T o2,
Comparator<? super T> comparator)
Compares the two specified objects and returns the greater one. |
|
static
|
min(T o1,
T o2)
Compares the two specified objects and returns the smaller one. |
|
static
|
min(T o1,
T o2,
Comparator<? super T> comparator)
Compares the two specified objects and returns the smaller one. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean areEqual(Object o1,
Object o2)
null.
o1 - first object to compareo2 - second object to compare
true iff both objects are null or
both objects are equal.
public static <T> int compare(T o1,
T o2,
Comparator<T> c)
o1 - first object to compareo2 - second object to comparec - comparator to use for comparison
or null if natural ordering is used
ClassCastException - if o1 and o2
cannot be compared to one another using
the comparator (or, if it is null,
using natural ordering).
NullPointerException - if o1 or o2
is null and natural order is used,
or if the comparator does not tolerate null elements.
public static <T> T max(T o1,
T o2,
Comparator<? super T> comparator)
o1 - first object to compareo2 - second object to comparecomparator - comparator to use for comparison
or null if natural ordering is used
o1 and o2.
If both are equal, o1 is returned.
ClassCastException - if o1 and o2
cannot be compared to one another using
the comparator (or, if it is null,
using natural ordering).
NullPointerException - if o1 or o2
is null and natural order is used,
or if the comparator does not tolerate null elements.
public static <T> T min(T o1,
T o2,
Comparator<? super T> comparator)
o1 - first object to compareo2 - second object to comparecomparator - comparator to use for comparison
or null if natural ordering is used
o1 and o2.
If both are equal, o1 is returned.
ClassCastException - if o1 and o2
cannot be compared to one another using
the comparator (or, if it is null,
using natural ordering).
NullPointerException - if o1 or o2
is null and natural order is used,
or if the comparator does not tolerate null elements.
public static <T> T max(T o1,
T o2)
o1 - first object to compareo2 - second object to compare
o1 and o2.
If both are equal, o1 is returned.
ClassCastException - if o1 and o2
cannot be compared to one another.
NullPointerException - if o1 or o2
is null.
public static <T> T min(T o1,
T o2)
o1 - first object to compareo2 - second object to compare
o1 and o2.
If both are equal, o1 is returned.
ClassCastException - if o1 and o2
cannot be compared to one another.
NullPointerException - if o1 or o2
is null.
public static <T> boolean isSorted(Iterator<T> it,
Comparator<? super T> comparator)
it - iterator to be examinedcomparator - comparator to use for comparison
or null if natural ordering is used
true if the specified iterator is in sorted order
of the specified comparator.
ClassCastException - if the elements of the iterator cannont
be compared to one another using.
the comparator (or, if it is null,
using natural ordering).
NullPointerException - the iterator contains a null
element and natural order is used,
or if the comparator does not tolerate null elements.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||