public class Limits
extends java.lang.Object
Offers static methods in order to limit values to a given range.
Constructor and Description |
---|
Limits() |
Modifier and Type | Method and Description |
---|---|
static <T extends java.lang.Comparable<T>> |
limit(T value,
T min,
T max)
Generic limit function.
|
public static <T extends java.lang.Comparable<T>> T limit(T value, T min, T max)
Generic limit function. Limits the given value to the given range (min, max).
T
- The type of the value and limits have to implement the Comparable interface.value
- The input value to limit.min
- The minimal value.max
- The maximal allowed value.