Closed
Description
If QueryResults<T>
extended Iterable<T>
rather than Iterator<T>
then it could be used in a for-each loop:
QueryResults<Entity> results = datastore.run(query);
for (Entity result : results) {...}
However, this is potentially confusing, because the Iterable
interface implies that the result can be iterated more than once, so we would either have to document that an attempt to do so will fail, or make it so that every time you call iterator()
a new query is issued. Neither of these is very desirable, so perhaps we should just add a note to QueryResults
that heads off this obvious question that users are going to ask.