Class RemoteMongoIterableImpl<ResultT>
- java.lang.Object
-
- com.mongodb.stitch.server.services.mongodb.remote.internal.RemoteMongoIterableImpl<ResultT>
-
- All Implemented Interfaces:
RemoteMongoIterable<ResultT>
,Iterable<ResultT>
- Direct Known Subclasses:
RemoteAggregateIterableImpl
,RemoteFindIterableImpl
public class RemoteMongoIterableImpl<ResultT> extends Object implements RemoteMongoIterable<ResultT>
-
-
Method Summary
Modifier and Type Method Description ResultT
first()
Helper to return the first item in the iterator or null.void
forEach(Block<? super ResultT> block)
Iterates over all documents in the view, applying the given block to each.<A extends Collection<? super ResultT>>
Ainto(A target)
Iterates over all the documents, adding each to the given target.RemoteMongoCursor<ResultT>
iterator()
Returns a cursor of the operation represented by this iterable.<U> RemoteMongoIterable<U>
map(Function<ResultT,U> mapper)
Maps this iterable from the source document type to the target document type.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
iterator
@Nonnull public RemoteMongoCursor<ResultT> iterator()
Description copied from interface:RemoteMongoIterable
Returns a cursor of the operation represented by this iterable.
-
first
@Nullable public ResultT first()
Description copied from interface:RemoteMongoIterable
Helper to return the first item in the iterator or null.- Specified by:
first
in interfaceRemoteMongoIterable<ResultT>
- Returns:
- T the first item or null.
-
map
public <U> RemoteMongoIterable<U> map(Function<ResultT,U> mapper)
Description copied from interface:RemoteMongoIterable
Maps this iterable from the source document type to the target document type.- Specified by:
map
in interfaceRemoteMongoIterable<ResultT>
- Type Parameters:
U
- the target document type- Parameters:
mapper
- a function that maps from the source to the target document type- Returns:
- an iterable which maps T to U
-
forEach
public void forEach(Block<? super ResultT> block)
Description copied from interface:RemoteMongoIterable
Iterates over all documents in the view, applying the given block to each.Similar to
map
but the function is fully encapsulated with no returned result.- Specified by:
forEach
in interfaceRemoteMongoIterable<ResultT>
- Parameters:
block
- the block to apply to each document of type T.
-
into
public <A extends Collection<? super ResultT>> A into(A target)
Description copied from interface:RemoteMongoIterable
Iterates over all the documents, adding each to the given target.- Specified by:
into
in interfaceRemoteMongoIterable<ResultT>
- Type Parameters:
A
- the collection type- Parameters:
target
- the collection to insert into- Returns:
- the target
-
-