@Override
    public Future<T> filter(Predicate<T> predicate) {
        Validator.requireNonNull(predicate, "Null is not a valid predicate");
        // Create new future expected to hold the value of the mapped type
        FutureImpl<T> future = new FutureImpl<>();
        // install success handler that will filter the result before applying it
        onSuccess(value -> {
            if (predicate.test(value)) {
                future.success(value);
            } else {
                future.failure(new NoSuchElementException("The predicate failed on value [" + value + "]"));
            }
        });
        // install failure handler that just passes the result through
        onFailure(t -> future.failure(t));
        return future;
    }
@Override
    public Future<T> filter(Predicate<T> predicate) {
        Validator.requireNonNull(predicate, "Null is not a valid predicate");
        
        FutureImpl<T> future = new FutureImpl<>();
        
        onSuccess(value -> {
            if (predicate.test(value)) {
                future.success(value);
            } else {
                future.failure(new NoSuchElementException("The predicate failed on value [" + value + "]"));
            }
        });
        
        onFailure(t -> future.failure(t));
        return future;
    }
@ Override public Future < T > filter ( Predicate < T > predicate ) { Validator . requireNonNull ( predicate , "Null is not a valid predicate" ) ; // Create new future expected to hold the value of the mapped type FutureImpl < T > future = new FutureImpl <> ( ) ; // install success handler that will filter the result before applying it onSuccess ( value -> { if ( predicate . test ( value ) ) { future . success ( value ) ; } else { future . failure ( new NoSuchElementException ( "The predicate failed on value [" + value + "]" ) ) ; } } ) ; // install failure handler that just passes the result through onFailure ( t -> future . failure ( t ) ) ; return future ; }
/*
(non-Javadoc)

@see javascalautils.concurrent.Future#filter(java.util.function.Predicate)
/ * ( non - Javadoc )