com.amazon.carbonado.cursor
Class IteratorCursor<S>
java.lang.Object
com.amazon.carbonado.cursor.AbstractCursor<S>
com.amazon.carbonado.cursor.IteratorCursor<S>
- All Implemented Interfaces:
- Cursor<S>
public class IteratorCursor<S>
- extends AbstractCursor<S>
Adapts an Iterator into a Cursor.
- Author:
- Brian S O'Neill
|
Method Summary |
void |
close()
Call close to release any resources being held by this cursor. |
boolean |
hasNext()
Returns true if this cursor has more elements. |
S |
next()
Returns the next element from this cursor. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IteratorCursor
public IteratorCursor(Iterable<S> iterable)
- Parameters:
iterable - collection to iterate over, or null for empty cursor
IteratorCursor
public IteratorCursor(Iterable<S> iterable,
Lock lock)
- Parameters:
iterable - collection to iterate over, or null for empty cursorlock - optional lock to hold while cursor is open
IteratorCursor
public IteratorCursor(Iterator<S> iterator)
- Parameters:
iterator - iterator to wrap, or null for empty cursor
close
public void close()
- Description copied from interface:
Cursor
- Call close to release any resources being held by this cursor. Further
operations on this cursor will behave as if there are no results.
hasNext
public boolean hasNext()
- Description copied from interface:
Cursor
- Returns true if this cursor has more elements. In other words, returns
true if
next would return an element rather than throwing
an exception.
next
public S next()
- Description copied from interface:
Cursor
- Returns the next element from this cursor. This method may be called
repeatedly to iterate through the results.
Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.