Package nom.tam.util

Interface Cursor<KEY,VALUE>

All Superinterfaces:
Iterator<VALUE>

public interface Cursor<KEY,VALUE> extends Iterator<VALUE>
This interface extends the Iterator interface to allow insertion of data and move to previous entries in a collection.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(KEY key, VALUE reference)
    Deprecated.
    use key parameter can be omitted, so use add(Object) instead
    void
    add(VALUE reference)
    Add an unkeyed element to the collection.
    end()
    move to the last element and return that.
    boolean
     
    next(int count)
    Returns the count next element in the iteration.
     
    void
    setKey(KEY key)
    Point the iterator to a particular keyed entry.

    Methods inherited from interface java.util.Iterator

    forEachRemaining, hasNext, next, remove
  • Method Details

    • add

      @Deprecated void add(KEY key, VALUE reference)
      Deprecated.
      use key parameter can be omitted, so use add(Object) instead
      Add 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 add
      reference - 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:
      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