|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.sf.molae.pipe.sorted.ComparatorUtil
Utility methods for Comparators.
| Method Summary | |
static boolean |
areEqual(Object o1,
Object o2)
Checks the specified objects for equality. |
static int |
compare(Object o1,
Object o2,
Comparator c)
Compares two objects using the specified comparator. |
static boolean |
isSorted(Iterator it,
Comparator comparator)
Checks if the specified iterator is in sorted order of the specified comparator. |
static Object |
max(Object o1,
Object o2)
Compares the two specified objects and returns the greater one. |
static Object |
max(Object o1,
Object o2,
Comparator comparator)
Compares the two specified objects and returns the greater one. |
static Object |
min(Object o1,
Object o2)
Compares the two specified objects and returns the smaller one. |
static Object |
min(Object o1,
Object o2,
Comparator 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 comparetrue iff both objects are null or
both objects are equal.
public static int compare(Object o1,
Object o2,
Comparator c)
o1 - first object to compareo2 - second object to comparec - comparator to use for comparison
or null if natural ordering is usedClassCastException - 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 Object max(Object o1,
Object o2,
Comparator comparator)
o1 - first object to compareo2 - second object to comparecomparator - comparator to use for comparison
or null if natural ordering is usedo1 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 Object min(Object o1,
Object o2,
Comparator comparator)
o1 - first object to compareo2 - second object to comparecomparator - comparator to use for comparison
or null if natural ordering is usedo1 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 Object max(Object o1,
Object o2)
o1 - first object to compareo2 - second object to compareo1 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 Object min(Object o1,
Object o2)
o1 - first object to compareo2 - second object to compareo1 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 boolean isSorted(Iterator it,
Comparator comparator)
it - iterator to be examinedcomparator - comparator to use for comparison
or null if natural ordering is usedtrue 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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||