Package nom.tam.util
Interface Cursor<KEY,VALUE>
-
- All Superinterfaces:
java.util.Iterator<VALUE>
public interface Cursor<KEY,VALUE> extends java.util.Iterator<VALUE>
This interface extends the Iterator interface to allow insertion of data and move to previous entries in a collection.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
add(KEY key, VALUE reference)
Deprecated.use key parameter can be omitted, so useadd(Object)
insteadvoid
add(VALUE reference)
Add an unkeyed element to the collection.VALUE
end()
move to the last element and return that.boolean
hasPrev()
VALUE
next(int count)
Returns the count next element in the iteration.VALUE
prev()
void
setKey(KEY key)
Point the iterator to a particular keyed entry.
-
-
-
Method Detail
-
add
@Deprecated void add(KEY key, VALUE reference)
Deprecated.use key parameter can be omitted, so useadd(Object)
insteadAdd a keyed entry at the current location. The new entry is inserted before the entry that would be returned in the next invocation of 'next'. The new element is placed such that it will be called by a prev() call, but not a next() call.The return value for that call is unaffected. Note: this method is not in the Iterator interface.- Parameters:
key
- the key of the value to addreference
- the value to add
-
add
void add(VALUE reference)
Add an unkeyed element to the collection. The new element is placed such that it will be called by a prev() call, but not a next() call.- Parameters:
reference
- the value to add
-
end
VALUE end()
move to the last element and return that.- Returns:
- the last element.
-
hasPrev
boolean hasPrev()
- Returns:
- Is there a previous element in the collection?
-
next
VALUE next(int count)
Returns the count next element in the iteration.- Parameters:
count
- the offset- Returns:
- the n'th next element in the iteration
- Throws:
java.util.NoSuchElementException
- if the iteration has no more elements
-
prev
VALUE prev()
- Returns:
- the previous element.
-
setKey
void setKey(KEY key)
Point the iterator to a particular keyed entry. Point to the end of the list if the key is not found.This method is not in the Iterator interface.- Parameters:
key
- the key to search for
-
-