public OptionalFunction < T , R > orElseThrow ( Supplier < ? extends RuntimeException > exceptionSupplier ) { return new OptionalFunction <> ( this . function , ( ) -> { throw exceptionSupplier . get ( ) ; } ) ; }
Creates a new OptionalFunction that will throw the exception supplied by the given supplier for null values .