code: public boolean hasNext() {
  		if(hitLast) {
  			return false;
  		}
  		if(cursor == null) {
  			return false;
  		}
  		if(!gotNext) {
  			OperationStatus status;
  			// attempt to get the next:
  			try {
  				if(backward) {
  					status = cursor.getPrev(key, value, LockMode.DEFAULT);
  				} else {
  					status = cursor.getNext(key, value, LockMode.DEFAULT);
  				}
  				if(status == OperationStatus.SUCCESS) {
  					gotNext = true;
  				} else {
  					close();
  				}
  			} catch (DatabaseException e) {
  				// SLOP: throw a runtime?
  				e.printStackTrace();
  				close();
  			}			
  		}
  		return gotNext;
  	}
docs: /* (non-Javadoc)
  @see java.util.Iterator#hasNext()