@Override public <A, T> List<T> query(Query<A> query, Function<A, T> entityFunc) { List<T> results = new ArrayList<>(); getDatastoreReadWriter().run(query) .forEachRemaining((x) -> results.add(entityFunc.apply(x))); return results; }
@Override public <A, T> List<T> query(Query<A> query, Function<A, T> entityFunc) { List<T> results = new ArrayList<>(); getDatastoreReadWriter().run(query) .forEachRemaining((x) -> results.add(entityFunc.apply(x))); return results; }
/** * Prefer this method over {@link #query(Query)} to avoid gathering large results in a list. * @see DatastoreReaderWriter#run(Query) * @throws IOException if the underlying client throws {@link DatastoreException} * or if {@code f} throws {@link IOException}. */ <T> void query(Query<T> query, IOConsumer<T> f) throws IOException { run(() -> rw.run(query).forEachRemaining(IOConsumer.unchecked(f))); }