@NonNull
    @Override
    public final ListenableFuture<InitialResult<T>> loadInitial(
            @NonNull final ListenablePositionalDataSource.LoadInitialParams params) {
        final ResolvableFuture<InitialResult<T>> future = ResolvableFuture.create();
        getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                final LoadInitialParams newParams = new LoadInitialParams(
                        params.requestedStartPosition,
                        params.requestedLoadSize,
                        params.pageSize,
                        params.placeholdersEnabled);
                LoadInitialCallback<T> callback = new LoadInitialCallback<T>() {
                    @Override
                    public void onResult(@NonNull List<T> data, int position, int totalCount) {
                        if (isInvalid()) {
                            // NOTE: this isInvalid() check works around
                            // https://issuetracker.google.com/issues/124511903
                            future.set(new InitialResult<>(Collections.<T>emptyList(), 0, 0));
                        } else {
                            setFuture(newParams, new InitialResult<>(data, position, totalCount));
                        }
                    }
                    @Override
                    public void onResult(@NonNull List<T> data, int position) {
                        if (isInvalid()) {
                            // NOTE: this isInvalid() check works around
                            // https://issuetracker.google.com/issues/124511903
                            future.set(new InitialResult<>(Collections.<T>emptyList(), 0));
                        } else {
                            setFuture(newParams, new InitialResult<>(data, position));
                        }
                    }
                    private void setFuture(
                            @NonNull ListenablePositionalDataSource.LoadInitialParams params,
                            @NonNull InitialResult<T> result) {
                        if (params.placeholdersEnabled) {
                            result.validateForInitialTiling(params.pageSize);
                        }
                        future.set(result);
                    }
                    @Override
                    public void onError(@NonNull Throwable error) {
                        future.setException(error);
                    }
                };
                loadInitial(newParams,
                        callback);
            }
        });
        return future;
    }
@NonNull
    @Override
    public final ListenableFuture<InitialResult<T>> loadInitial(
            @NonNull final ListenablePositionalDataSource.LoadInitialParams params) {
        final ResolvableFuture<InitialResult<T>> future = ResolvableFuture.create();
        getExecutor().execute(new Runnable() {
            @Override
            public void run() {
                final LoadInitialParams newParams = new LoadInitialParams(
                        params.requestedStartPosition,
                        params.requestedLoadSize,
                        params.pageSize,
                        params.placeholdersEnabled);
                LoadInitialCallback<T> callback = new LoadInitialCallback<T>() {
                    @Override
                    public void onResult(@NonNull List<T> data, int position, int totalCount) {
                        if (isInvalid()) {
                           
                           
                            future.set(new InitialResult<>(Collections.<T>emptyList(), 0, 0));
                        } else {
                            setFuture(newParams, new InitialResult<>(data, position, totalCount));
                        }
                    }
                    @Override
                    public void onResult(@NonNull List<T> data, int position) {
                        if (isInvalid()) {
                           
                           
                            future.set(new InitialResult<>(Collections.<T>emptyList(), 0));
                        } else {
                            setFuture(newParams, new InitialResult<>(data, position));
                        }
                    }
                    private void setFuture(
                            @NonNull ListenablePositionalDataSource.LoadInitialParams params,
                            @NonNull InitialResult<T> result) {
                        if (params.placeholdersEnabled) {
                            result.validateForInitialTiling(params.pageSize);
                        }
                        future.set(result);
                    }
                    @Override
                    public void onError(@NonNull Throwable error) {
                        future.setException(error);
                    }
                };
                loadInitial(newParams,
                        callback);
            }
        });
        return future;
    }
@nonnull @override public final listenablefuture<initialresult<t>> loadinitial( @nonnull final listenablepositionaldatasource.loadinitialparams params) { final resolvablefuture<initialresult<t>> future = resolvablefuture.create(); getexecutor().execute(new runnable() { @override public void run() { final loadinitialparams newparams = new loadinitialparams( params.requestedstartposition, params.requestedloadsize, params.pagesize, params.placeholdersenabled); loadinitialcallback<t> callback = new loadinitialcallback<t>() { @override public void onresult(@nonnull list<t> data, int position, int totalcount) { if (isinvalid()) { future.set(new initialresult<>(collections.<t>emptylist(), 0, 0)); } else { setfuture(newparams, new initialresult<>(data, position, totalcount)); } } @override public void onresult(@nonnull list<t> data, int position) { if (isinvalid()) { future.set(new initialresult<>(collections.<t>emptylist(), 0)); } else { setfuture(newparams, new initialresult<>(data, position)); } } private void setfuture( @nonnull listenablepositionaldatasource.loadinitialparams params, @nonnull initialresult<t> result) { if (params.placeholdersenabled) { result.validateforinitialtiling(params.pagesize); } future.set(result); } @override public void onerror(@nonnull throwable error) { future.setexception(error); } }; loadinitial(newparams, callback); } }); return future; }