Package org.dashbuilder.comparator
Class ComparatorUtils
- java.lang.Object
-
- org.dashbuilder.comparator.ComparatorUtils
-
public class ComparatorUtils extends Object
Helper class containing methods for the comparison between different types.
-
-
Constructor Summary
Constructors Constructor Description ComparatorUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcompare(Boolean o1, Boolean o2, int ordering)Compares two booleans.static intcompare(Comparable o1, Comparable o2, int ordering)Compares two comparable objects.static intcompare(Object o1, Object o2, int ordering)Compares two objects.static intcompare(Object obj, Collection col, int ordering)Compare an element with the collection elements.static intcompare(Collection o1, Collection o2, int ordering)Compares two collections.static intcompare(Date o1, Date o2, int ordering)Compares two dates.
-
-
-
Method Detail
-
compare
public static int compare(Comparable o1, Comparable o2, int ordering)
Compares two comparable objects.- Parameters:
ordering- : 1=ascending, -1=descending
-
compare
public static int compare(Date o1, Date o2, int ordering)
Compares two dates.- Parameters:
ordering- : 1=ascending, -1=descending
-
compare
public static int compare(Boolean o1, Boolean o2, int ordering)
Compares two booleans.- Parameters:
ordering- : 1=ascending, -1=descending
-
compare
public static int compare(Collection o1, Collection o2, int ordering)
Compares two collections. A collection is considered greater than other if it has one element greater than all other collection elements.- Parameters:
ordering- : 1=ascending, -1=descending
-
compare
public static int compare(Object obj, Collection col, int ordering)
Compare an element with the collection elements. The element is greater than the collection if it is greater than ALL of its elements. The element is smaller than the collection if it is smaller than ALL of its elements.- Parameters:
ordering- : 1=ascending, -1=descending
-
-