Package com.google.gerrit.index.query
Interface ResultSet<T>
-
- Type Parameters:
T
- type of entity being returned by the query.
- All Superinterfaces:
Iterable<T>
- All Known Implementing Classes:
LazyResultSet
,ListResultSet
public interface ResultSet<T> extends Iterable<T>
Result from any data store query function.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close the result, discarding any further results.Iterator<T>
iterator()
Obtain an iterator to loop through the results.com.google.common.collect.ImmutableList<T>
toList()
Materialize all results as a single list.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
iterator
Iterator<T> iterator()
Obtain an iterator to loop through the results.The iterator can be obtained only once. When the iterator completes (
hasNext()
returns false)close()
will be automatically called.
-
toList
com.google.common.collect.ImmutableList<T> toList()
Materialize all results as a single list.Prior to returning
close()
is invoked. This method must not be combined withiterator()
on the same instance.- Returns:
- immutable list of the complete results.
-
close
void close()
Close the result, discarding any further results.This method may be invoked more than once. Its main use is to stop obtaining results before the iterator has finished.
-
-