List of utility methods to do Number Between
boolean | between(Comparable obj, Comparable from, Comparable to) Checks if the given object is between the last two parameter values. int compareObjFrom = compare(obj, from); int compareObjTo = compare(obj, to); return (compareObjFrom >= 0) && (compareObjTo <= 0); |
T | between(T lower, T upper, T value) Returns a value which is within the lower and upper borders. return (lower.compareTo(value) < 0) ? lower : ((upper.compareTo(value) > 0) ? upper : value);
|
boolean | between(T subject, T lower, T upper, boolean exclLowerEnd, boolean exclUpperEnd) between if (subject == null) return false; boolean validExclEnds = (lower == null ? true : lower.compareTo(subject) < 0) && (upper == null ? true : upper.compareTo(subject) > 0); return validExclEnds || (!exclLowerEnd && subject.equals(lower)) || (!exclUpperEnd && subject.equals(upper)); |