E
- The type of item in the wrapped cursor.C
- The type of aggregate to be returned by this cursor.public abstract class GroupingCursor<C,E> extends AbstractCursor<C>
Modifier | Constructor and Description |
---|---|
protected |
GroupingCursor(Cursor<? extends E> base) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
clearGroup()
Clear the accumulated group.
|
void |
close()
No-op implementation of the
Cursor.close() method. |
protected abstract C |
finishGroup()
Finish the current group and return it.
|
protected abstract boolean |
handleItem(E item)
Handle an item from the base cursor.
|
boolean |
hasNext()
Query whether the cursor has any more items.
|
C |
next()
Fetch the next item from the cursor.
|
fast, fastNext, getRowCount, iterator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public boolean hasNext()
Cursor
true
if there remains another item to fetch.@Nonnull public C next()
Cursor
public void close()
AbstractCursor
Cursor.close()
method.close
in interface Closeable
close
in interface AutoCloseable
close
in interface Cursor<C>
close
in class AbstractCursor<C>
protected abstract void clearGroup()
close()
.protected abstract boolean handleItem(E item)
item
- The item to handle.true
if the item has been accepted and added to the group; false
if
it cannot be added to the current group. If it cannot be added to the current group,
the cursor will call finishGroup()
to finish the group, and then call this
method again with item
(at which point it is required to return true
).@Nonnull protected abstract C finishGroup()
#handleItem(E)
should add items to a new group. This method will not be called unless #handleItem(E)
has been called at least once since the last group was finished.