Package science.aist.jack.math
Class MinMax<T>
- java.lang.Object
-
- science.aist.jack.math.MinMax<T>
-
public class MinMax<T> extends Object
Optional-like Wrapper class for wrapping two values: a min and a max value
- Since:
- 2.0
- Author:
- Christoph Praschl
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <I> MinMax<I>
empty()
void
ifPresent(BiConsumer<T,T> consumer)
Method which executes the given consumer if this is present<I> Optional<I>
map(BiFunction<T,T,I> mapper)
Maps the given min and max value if present using the mapperstatic <I> MinMax<I>
of(I min, I max)
-
-
-
Method Detail
-
empty
public static <I> MinMax<I> empty()
-
of
public static <I> MinMax<I> of(I min, I max)
-
ifPresent
public void ifPresent(BiConsumer<T,T> consumer)
Method which executes the given consumer if this is present- Parameters:
consumer
- function which consumes the min (first value) and the max (second value) if present
-
map
public <I> Optional<I> map(BiFunction<T,T,I> mapper)
Maps the given min and max value if present using the mapper- Type Parameters:
I
- result type of the mapping- Parameters:
mapper
- used to map min and max if present- Returns:
- Optional containing the mapping result iff present else empty
-
-