T
- The type of value returned by this cursor.public abstract class AbstractCursor<T> extends java.lang.Object implements Cursor<T>
Cursor
s easier to implement.Compatibility: Public
Constructor and Description |
---|
AbstractCursor()
Construct a cursor of unknown size.
|
AbstractCursor(int nrows)
Construct a cursor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
No-op implementation of the
Cursor.close() method. |
java.lang.Iterable<T> |
fast()
Convert the cursor to an iterable whose
Iterator.next() method is
implemented in terms of Cursor.fastNext() . |
T |
fastNext()
Variant of
Cursor.next() that may mutate and return the same object
avoid excess allocations. |
int |
getRowCount()
Get an upper bound on the number of rows available from the cursor.
|
java.util.Iterator<T> |
iterator()
Get the iterator.
|
public AbstractCursor()
public AbstractCursor(int nrows)
nrows
- The number of rows, or -1 for unknown size.public int getRowCount()
Cursor
getRowCount
in interface Cursor<T>
Cursor.next()
,
or -1 if that count is not available.public void close()
Cursor.close()
method.@Nonnull public T fastNext()
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>
Cursor.next()
public java.lang.Iterable<T> fast()
Cursor
Iterator.next()
method is
implemented in terms of Cursor.fastNext()
.