Futures { public static <T> Future<T> withCallable(Callable<T> callable){ return withCallable(EXECUTOR, callable); } private  Futures(); static FutureWithTrigger<T> withTrigger(); static Future<T> withCallback(Consumer<Callback<T>> consumer); static Future<T> withValue(T value); static Future<T> withException(Exception exception); static Future<T> withCallable(Callable<T> callable); static Future<T> withCallable(Executor executor, Callable<T> callable); static Future<Set<T>> all(Future<T>... futures); static Future<Set<T>> all(Iterable<Future<T>> futures); static Future<T> any(Future<T>... futures); static Future<T> any(Iterable<Future<T>> futures);  }
@Test public void testWithCallable() throws Exception { Future<Integer> future = Futures.withCallable(() -> 1); int result = future.await(); assertEquals(1, result); }
@Test public void testWithCallableAndExecutor() throws Exception { Future<Integer> future = Futures.withCallable(Executors.newCachedThreadPool(), () -> 1); int result = future.await(); assertEquals(1, result); }