Class CoreRemoteMappingIterable<U,V>
- java.lang.Object
-
- com.mongodb.stitch.core.services.mongodb.remote.internal.CoreRemoteMappingIterable<U,V>
-
- All Implemented Interfaces:
CoreRemoteMongoIterable<V>
,Iterable<V>
public class CoreRemoteMappingIterable<U,V> extends Object implements CoreRemoteMongoIterable<V>
-
-
Constructor Summary
Constructors Constructor Description CoreRemoteMappingIterable(CoreRemoteMongoIterable<U> iterable, Function<U,V> mapper)
-
Method Summary
Modifier and Type Method Description V
first()
Helper to return the first item in the iterator or null.void
forEach(Block<? super V> block)
Iterates over all documents in the view, applying the given block to each.<A extends Collection<? super V>>
Ainto(A target)
Iterates over all the documents, adding each to the given target.CoreRemoteMongoCursor<V>
iterator()
<W> CoreRemoteMongoIterable<W>
map(Function<V,W> newMap)
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
-
-
-
-
Constructor Detail
-
CoreRemoteMappingIterable
public CoreRemoteMappingIterable(CoreRemoteMongoIterable<U> iterable, Function<U,V> mapper)
-
-
Method Detail
-
iterator
@Nonnull public CoreRemoteMongoCursor<V> iterator()
-
first
@Nullable public V first()
Description copied from interface:CoreRemoteMongoIterable
Helper to return the first item in the iterator or null.- Specified by:
first
in interfaceCoreRemoteMongoIterable<U>
- Returns:
- T the first item or null.
-
forEach
public void forEach(Block<? super V> block)
Description copied from interface:CoreRemoteMongoIterable
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 interfaceCoreRemoteMongoIterable<U>
- Parameters:
block
- the block to apply to each document of type T.
-
into
public <A extends Collection<? super V>> A into(A target)
Description copied from interface:CoreRemoteMongoIterable
Iterates over all the documents, adding each to the given target.- Specified by:
into
in interfaceCoreRemoteMongoIterable<U>
- Type Parameters:
A
- the collection type- Parameters:
target
- the collection to insert into- Returns:
- the target
-
map
public <W> CoreRemoteMongoIterable<W> map(Function<V,W> newMap)
Description copied from interface:CoreRemoteMongoIterable
Maps this iterable from the source document type to the target document type.- Specified by:
map
in interfaceCoreRemoteMongoIterable<U>
- Type Parameters:
W
- the target document type- Parameters:
newMap
- a function that maps from the source to the target document type- Returns:
- an iterable which maps T to U
-
-