Class 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 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