inclusiveBetween static method
void
inclusiveBetween(
- Comparable start,
- Comparable end,
- Comparable value, [
- String message = DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE,
Validate that the specified argument object fall between the two inclusive values specified; otherwise, throws an exception.
Validate.inclusiveBetween(0, 2, 1);
start
the inclusive start value, not null
end
the inclusive end value, not null
value
the object to validate, not null
Throws ArgumentError if the value falls out of the boundaries
Implementation
static void inclusiveBetween(
Comparable start, Comparable end, Comparable value,
[String message = DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE]) {
if (value.compareTo(start) < 0 || value.compareTo(end) > 0) {
throw new ArgumentError(message);
}
}