Interface SequentialCursor<K,V>
-
- Type Parameters:
K- Type of the record's keyV- Type of the record's value
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Subinterfaces:
Cursor<K,V>
- All Known Implementing Classes:
EmptyCursor
public interface SequentialCursor<K,V> extends Closeable
Cursor extended with navigation methods.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()voiddelete()Deletes the record on which this cursor is currently positioned.KgetKey()Returns the key of the record on which this cursor is currently positioned.VgetValue()Returns the value of the record on which this cursor is currently positioned.booleanisDefined()Check whether this cursor is currently pointing to valid record.booleannext()Moves this cursor to the next record in the tree.
-
-
-
Method Detail
-
next
boolean next()
Moves this cursor to the next record in the tree.- Returns:
trueif the cursor has moved to the next record,falseif no next record exists leaving cursor in undefined state.
-
isDefined
boolean isDefined()
Check whether this cursor is currently pointing to valid record.- Returns:
trueif the cursor is pointing to a valid entry,falseif cursor is not pointing to a valid entry
-
getKey
K getKey() throws NoSuchElementException
Returns the key of the record on which this cursor is currently positioned.- Returns:
- the current record's key.
- Throws:
NoSuchElementException- if the cursor is not defined.
-
getValue
V getValue() throws NoSuchElementException
Returns the value of the record on which this cursor is currently positioned.- Returns:
- the current record's value.
- Throws:
NoSuchElementException- if the cursor is not defined.
-
delete
void delete() throws NoSuchElementException, UnsupportedOperationExceptionDeletes the record on which this cursor is currently positioned. This method does not alter the position of the cursor. In particular,next()must be called in order to point to the next record. The behavior of methodsgetKey()andgetValue()after this method returns is undefined.- Throws:
NoSuchElementException- if the cursor is not defined.UnsupportedOperationException- if the cursor implementation does not support updates.
-
close
void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-