T
- public abstract class AbstractPollingCursor<T> extends AbstractCursor<T>
poll()
.Constructor and Description |
---|
AbstractPollingCursor()
Construct a cursor of unknown size.
|
AbstractPollingCursor(int rowCount)
Construct a cursor with a known number of rows.
|
Modifier and Type | Method and Description |
---|---|
protected T |
copy(T obj)
Construct a copy of an object.
|
T |
fastNext()
Deprecated.
|
boolean |
hasNext()
Query whether the cursor has any more items.
|
T |
next()
Fetch the next item from the cursor.
|
protected abstract T |
poll()
Return the next element in this Cursor, or null if there are no more
elements.
|
close, fast, getRowCount, iterator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public AbstractPollingCursor()
public AbstractPollingCursor(int rowCount)
rowCount
- The number of rows, or -1 for unknown size.public boolean hasNext()
Cursor
true
if there remains another item to fetch.@Nonnull @Deprecated public T fastNext()
AbstractCursor
Cursor.next()
that may mutate and return the same object
avoid excess allocations. Since many loops don't do anything with the
object after the iteration in which it is retrieved, using this iteration
method can improve both speed and memory use.
This implementation delegates to Cursor.next()
.
fastNext
in interface Cursor<T>
fastNext
in class AbstractCursor<T>
Cursor.next()
@Nonnull public T next()
Cursor
protected abstract T poll()
copy(Object)
copies objects. If this
method returns a fresh object every time, then copy(Object)
should be a no-op.protected T copy(T obj)
poll()
method, and override this method to create a new copy of an object for when
next()
is called. Subclasses which return fresh objects on each
call to poll()
do not need to override this method.obj
- The object to copy.obj
.