T
- The type of elements being iterated over.public interface MongoIterator<T> extends Iterator<T>, Iterable<T>, MongoCursorControl, ClosableIterator<T>
In addition the batch size for the next request for documents from the cursor can be set.
BATCH_SIZE_FIELD, CURSOR_ID_FIELD, LIMIT_FIELD, NAME_SPACE_FIELD, SERVER_FIELD
Modifier and Type | Method and Description |
---|---|
Object[] |
toArray()
Consumes all of the elements in the iterator and returns them in a single
array.
|
<S> S[] |
toArray(S[] to)
Consumes all of the elements in the iterator and returns them in a single
array.
|
List<T> |
toList()
Consumes all of the elements in the iterator and returns them in a single
mutable list.
|
asDocument, close, getBatchSize, setBatchSize, stop
close, getBatchSize, setBatchSize
Object[] toArray()
WARNING: This method loads all of the iterator results into memory and
may cause an OutOfMemoryError
.
<S> S[] toArray(S[] to)
WARNING: This method loads all of the iterator results into memory and
may cause an OutOfMemoryError
.
S
- The type of elements in the array.to
- The array to copy into. If not the right size a new array will
be allocated of the right size.List<T> toList()
WARNING: This method loads all of the iterator results into memory and
may cause an OutOfMemoryError
.
Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.