Package org.camunda.bpm.engine.impl.util
Class CompareUtil
java.lang.Object
org.camunda.bpm.engine.impl.util.CompareUtil
Util class for comparisons.
- Author:
- Filip Hrisafov
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T extends Comparable<T>>
 booleanareNotInAscendingOrder(List<T> values) Checks if any of the values are not in an ascending order.static <T extends Comparable<T>>
 booleanareNotInAscendingOrder(T... values) Checks if any of the values are not in an ascending order.static <T> booleanelementIsContainedInArray(T element, T... values) Checks if the element is contained within the list of values.static <T> booleanelementIsContainedInList(T element, Collection<T> values) Checks if the element is contained within the list of values.static <T> booleanelementIsNotContainedInArray(T element, T... values) Checks if the element is contained within the list of values.static <T> booleanelementIsNotContainedInList(T element, Collection<T> values) Checks if the element is not contained within the list of values.static <T> booleanelementsAreContainedInArray(Collection<T> subset, T[] superset) static <T extends Comparable<T>>
 Tmax(T obj1, T obj2) Returns any element if obj1.compareTo(obj2) == 0static <T extends Comparable<T>>
 Tmin(T obj1, T obj2) Returns any element if obj1.compareTo(obj2) == 0
- 
Constructor Details- 
CompareUtilpublic CompareUtil()
 
- 
- 
Method Details- 
areNotInAscendingOrderChecks if any of the values are not in an ascending order. The check is done based on theComparable.compareTo(Object)method. E.g. if we haveminPriority = 10,priority = 13andmaxPriority = 5andInteger[] values = {minPriority, priority, maxPriority}. Then a call toareNotInAscendingOrder(Comparable[] values)will returntrue- Type Parameters:
- T- the type of the comparable
- Parameters:
- values- to validate
- Returns:
- falseif the not null values are in an ascending order or all the values are null,- trueotherwise
 
- 
areNotInAscendingOrderChecks if any of the values are not in an ascending order. The check is done based on theComparable.compareTo(Object)method. E.g. if we haveminPriority = 10,priority = 13andmaxPriority = 5andList<Integer> values = {minPriority, priority, maxPriority}. Then a call toareNotInAscendingOrder(List values)will returntrue- Type Parameters:
- T- the type of the comparable
- Parameters:
- values- to validate
- Returns:
- falseif the not null values are in an ascending order or all the values are null,- trueotherwise
 
- 
elementIsNotContainedInListChecks if the element is not contained within the list of values. If the element, or the list are null then true is returned.- Type Parameters:
- T- the type of the element
- Parameters:
- element- to check
- values- to check in
- Returns:
- trueif the element and values are not- nulland the values does not contain the element,- falseotherwise
 
- 
elementIsNotContainedInArraypublic static <T> boolean elementIsNotContainedInArray(T element, T... values) Checks if the element is contained within the list of values. If the element, or the list are null then true is returned.- Type Parameters:
- T- the type of the element
- Parameters:
- element- to check
- values- to check in
- Returns:
- trueif the element and values are not- nulland the values does not contain the element,- falseotherwise
 
- 
elementIsContainedInListChecks if the element is contained within the list of values.- Type Parameters:
- T- the type of the element
- Parameters:
- element- to check
- values- to check in
- Returns:
- trueif the element and values are not- nulland the values contain the element,- falseotherwise
 
- 
elementIsContainedInArraypublic static <T> boolean elementIsContainedInArray(T element, T... values) Checks if the element is contained within the list of values.- Type Parameters:
- T- the type of the element
- Parameters:
- element- to check
- values- to check in
- Returns:
- trueif the element and values are not- nulland the values contain the element,- falseotherwise
 
- 
minReturns any element if obj1.compareTo(obj2) == 0
- 
maxReturns any element if obj1.compareTo(obj2) == 0
- 
elementsAreContainedInArray
 
-