@Override
    public <R> Future<R> transform(ThrowableFunction1<T, R> onSuccess, ThrowableFunction1<Throwable, Throwable> onFailure) {
        Validator.requireNonNull(onSuccess, "Null is not a valid function");
        Validator.requireNonNull(onFailure, "Null is not a valid function");
        // Create new future expected to hold the value of the mapped type
        FutureImpl<R> future = new FutureImpl<>();
        // install success handler that will map the result before applying it
        onSuccess(value -> future.complete(Try(() -> onSuccess.apply(value))));
        // install failure handler that will map the error before applying it
        onFailure(t -> Try(() -> onFailure.apply(t)).recover(ex -> ex).forEach(ex -> future.failure(ex)));
        return future;
    }
@Override
    public <R> Future<R> transform(ThrowableFunction1<T, R> onSuccess, ThrowableFunction1<Throwable, Throwable> onFailure) {
        Validator.requireNonNull(onSuccess, "Null is not a valid function");
        Validator.requireNonNull(onFailure, "Null is not a valid function");
        
        FutureImpl<R> future = new FutureImpl<>();
        
        onSuccess(value -> future.complete(Try(() -> onSuccess.apply(value))));
        
        onFailure(t -> Try(() -> onFailure.apply(t)).recover(ex -> ex).forEach(ex -> future.failure(ex)));
        return future;
    }
@ Override public < R > Future < R > transform ( ThrowableFunction1 < T , R > onSuccess , ThrowableFunction1 < Throwable , Throwable > onFailure ) { Validator . requireNonNull ( onSuccess , "Null is not a valid function" ) ; Validator . requireNonNull ( onFailure , "Null is not a valid function" ) ; // Create new future expected to hold the value of the mapped type FutureImpl < R > future = new FutureImpl <> ( ) ; // install success handler that will map the result before applying it onSuccess ( value -> future . complete ( Try ( ( ) -> onSuccess . apply ( value ) ) ) ) ; // install failure handler that will map the error before applying it onFailure ( t -> Try ( ( ) -> onFailure . apply ( t ) ) . recover ( ex -> ex ) . forEach ( ex -> future . failure ( ex ) ) ) ; return future ; }
/*
(non-Javadoc)

@see javascalautils.concurrent.Future#transform(java.util.function.Function, java.util.function.Function)
/ * ( non - Javadoc )