T
- The type that this iterable will decode documents to.public interface MongoIterable<T> extends Iterable<T>
Modifier and Type | Method and Description |
---|---|
T |
first()
Helper to return the first item in the iterator or null.
|
void |
forEach(Block<? super T> block)
Iterates over all documents in the view, applying the given block to each.
|
<A extends Collection<? super T>> |
into(A target)
Iterates over all the documents, adding each to the given target.
|
MongoCursor<T> |
iterator() |
<U> MongoIterable<U> |
map(Function<T,U> mapper)
Maps this iterable from the source document type to the target document type.
|
MongoCursor<T> iterator()
T first()
<U> MongoIterable<U> map(Function<T,U> mapper)
U
- the target document typemapper
- a function that maps from the source to the target document typevoid forEach(Block<? super T> block)
Similar to map
but the function is fully encapsulated with no returned result.
block
- the block to apply to each document of type T.<A extends Collection<? super T>> A into(A target)
A
- the collection typetarget
- the collection to insert into