Code example for ListenableFuture

Methods: addListener

    // implements ListenableFuture<APIResponse> 
    public void addListener(Runnable listener, Executor executor) {
        this.apiResponse.addListener(listener, executor);
    // implements Future<APIResponse> 
    public boolean cancel(boolean mayInterruptIfRunning) {
        return this.apiResponse.cancel(mayInterruptIfRunning);
    public APIResponse get() throws ExecutionException, InterruptedException {
        return this.apiResponse.get();
    public APIResponse get(long timeout, TimeUnit unit) throws ExecutionException, InterruptedException, TimeoutException {
        return this.apiResponse.get(timeout, unit);
Connect your IDE to all the code out there  Get Codota for Java