Package io.realm.mongodb.mongo.iterable
Class MongoCursor<ResultT>
- java.lang.Object
-
- io.realm.mongodb.mongo.iterable.MongoCursor<ResultT>
-
- Type Parameters:
ResultT- The type of documents the cursor contains
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterator<ResultT>
public class MongoCursor<ResultT> extends Object implements Iterator<ResultT>, Closeable
The Mongo Cursor class is fundamentally anIteratorcontaining an additionaltryNext()method for convenience.An application should ensure that a cursor is closed in all circumstances, e.g. using a try-with-resources statement.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanhasNext()ResultTnext()ResultTtryNext()A specialnext()case that returns the next document if available or null.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Method Detail
-
tryNext
public ResultT tryNext()
A specialnext()case that returns the next document if available or null.- Returns:
- A
Taskcontaining the next document if available or null.
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-