public interface EntityIterator extends java.util.Iterator<Entity>
EntityIterator is an iterator of EntityIterable. It is an Iterator<Entity>, but it
also allows to enumerate entity ids instead of entities using method
nextId(). Getting only ids provides better iteration performance.
Method dispose() releases all resources which the iterator possibly consumes. Method
shouldBeDisposed() definitely says if it does. Method dispose() can be called implicitly
in two cases: if iteration finishes and Iterator.hasNext() returns false and if the transaction
finishes or moves to the latest snapshot (any of StoreTransaction.commit(),
StoreTransaction.abort(), StoreTransaction.flush() or
StoreTransaction.revert() is called).
EntityIterable,
EntityId,
Entity,
StoreTransaction| Modifier and Type | Method and Description |
|---|---|
boolean |
dispose()
Disposes the
EntityIterator and frees all resources possibly consumed by it. |
@Nullable EntityId |
nextId()
Returns next entity id.
|
boolean |
shouldBeDisposed() |
boolean |
skip(int number)
Skips specified number of entities and returns the value of Iterator.hasNext().
|
boolean skip(int number)
number - number of entities to skiptrue if there are more entities available@Nullable @Nullable EntityId nextId()
java.util.NoSuchElementException - if the EntityIterator has no more elementsboolean dispose()
EntityIterator and frees all resources possibly consumed by it.true if the EntityIterator was actually disposedboolean shouldBeDisposed()
true if method dispose() should be called in order to avoid leaks.