// Path: deferred/src/main/java/com/tuenti/deferred/PromiseObjectTask.java
// public interface Filter<D> {
// 	boolean success(D result);
// }


import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import com.tuenti.deferred.PromiseObjectTask.Filter;
		if (task.getStartPolicy() == StartPolicy.AUTO
				|| task.getStartPolicy() == StartPolicy.DEFAULT && isAutoSubmit()) {
			submit(task);
		}
		return task.promise();
	}

	@Override
	public <D> Promise<D, Throwable, Void> when(final Future<D> future) {
		// make sure the task is automatically started

		return when(new DeferredCallable<D, Void>(executorProvider, StartPolicy.AUTO) {
			@Override
			public D call() throws Exception {
				try {
					return future.get();
				} catch (InterruptedException e) {
					throw e;
				} catch (ExecutionException e) {
					if (e.getCause() instanceof Exception) {
						throw (Exception) e.getCause();
					} else {
						throw e;
					}
				}
			}
		});
	}

	@Override
// Path: deferred/src/main/java/com/tuenti/deferred/PromiseObjectTask.java
// public interface Filter<D> {
// 	boolean success(D result);
// }


// Path: deferred/src/main/java/com/tuenti/deferred/AbstractDeferredManager.java
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import com.tuenti.deferred.PromiseObjectTask.Filter;

		if (task.getStartPolicy() == StartPolicy.AUTO
				|| task.getStartPolicy() == StartPolicy.DEFAULT && isAutoSubmit()) {
			submit(task);
		}
		return task.promise();
	}

	@Override
	public <D> Promise<D, Throwable, Void> when(final Future<D> future) {
		// make sure the task is automatically started

		return when(new DeferredCallable<D, Void>(executorProvider, StartPolicy.AUTO) {
			@Override
			public D call() throws Exception {
				try {
					return future.get();
				} catch (InterruptedException e) {
					throw e;
				} catch (ExecutionException e) {
					if (e.getCause() instanceof Exception) {
						throw (Exception) e.getCause();
					} else {
						throw e;
					}
				}
			}
		});
	}

	@Override
	public <D, F, P> Promise<D, F, P> sequentiallyRunUntilFirstDone(final PromiseObjectTask.Filter<D> filter,