Package nom.tam.util

Interface Cursor<KEY,VALUE>

Type Parameters:
KEY - the generic type of the keyword element
VALUE - the generic type of the associated value
All Superinterfaces:
Iterator<VALUE>

public interface Cursor<KEY,VALUE> extends Iterator<VALUE>
An Iterator-based interface for key / value pairs allowing insertions and reverse movement also.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(KEY key, VALUE reference)
    Deprecated.
    Use add(Object) instead
    void
    add(VALUE reference)
    Add an unkeyed element to the collection.
    end()
    Moves to the last element and returns it.
    boolean
    Checks if there is an element prior to the current one.
    next(int count)
    Returns the count next element in the iteration.
    Returns the previous element in the ordered collection.
    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 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()
      Moves to the last element and returns it.
      Returns:
      the last element.
    • hasPrev

      boolean hasPrev()
      Checks if there is an element prior to the current one.
      Returns:
      Whether there is 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 in the ordered collection.
      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