class Test { public static Future foo(Future future, Function function) { return future.map(function); } // These interfaces inspired by FoundationDB Java client class files interface PartialFunction { VP apply(TP t) throws java.lang.Exception; } interface Function extends PartialFunction { VF apply(TF t); } interface PartialFuture { PartialFuture map(PartialFunction partialFunction); } interface Future extends PartialFuture { Future map(Function function); } }