com.venmo.cursor.CursorIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of library Show documentation
Show all versions of library Show documentation
A library that encapsulates the repeatable actions of Android Cursors.
package com.venmo.cursor;
import java.util.Iterator;
/**
* Default iterator for all {@link IterableCursor}s.
*/
public class CursorIterator implements Iterator {
private IterableCursor mCursor;
public CursorIterator(IterableCursor cursor) {
mCursor = cursor;
}
@Override
public boolean hasNext() {
return !mCursor.isBeforeFirst() && !mCursor.isAfterLast();
}
@Override
public T next() {
return mCursor.nextDocument();
}
@Override
public void remove() {
throw new UnsupportedOperationException("Cannot remove an object in a cursor");
}
}