Package nom.tam.util

Class HashedList.HashedListIterator

  • All Implemented Interfaces:
    java.util.Iterator<VALUE>, Cursor<java.lang.String,​VALUE>
    Enclosing class:
    HashedList<VALUE extends CursorValue<java.lang.String>>

    private class HashedList.HashedListIterator
    extends java.lang.Object
    implements Cursor<java.lang.String,​VALUE>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int current
      This index points to the value that would be returned in the next 'next' call.
    • Constructor Summary

      Constructors 
      Constructor Description
      HashedListIterator​(int start)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String key, VALUE ref)
      Add a keyed entry at the current location.
      void add​(VALUE reference)
      Add an unkeyed element to the collection.
      VALUE end()
      move to the last element and return that.
      boolean hasNext()  
      boolean hasPrev()  
      VALUE next()  
      VALUE next​(int count)
      Returns the count next element in the iteration.
      VALUE prev()  
      void remove()  
      void setKey​(java.lang.String key)
      Point the iterator to a particular keyed entry.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Field Detail

      • current

        private int current
        This index points to the value that would be returned in the next 'next' call.
    • Constructor Detail

      • HashedListIterator

        HashedListIterator​(int start)
    • Method Detail

      • add

        public void add​(java.lang.String key,
                        VALUE ref)
        Description copied from interface: Cursor
        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.
        Specified by:
        add in interface Cursor<java.lang.String,​VALUE extends CursorValue<java.lang.String>>
        Parameters:
        key - the key of the value to add
        ref - the value to add
      • add

        public void add​(VALUE reference)
        Description copied from interface: Cursor
        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.
        Specified by:
        add in interface Cursor<java.lang.String,​VALUE extends CursorValue<java.lang.String>>
        Parameters:
        reference - the value to add
      • end

        public VALUE end()
        Description copied from interface: Cursor
        move to the last element and return that.
        Specified by:
        end in interface Cursor<java.lang.String,​VALUE extends CursorValue<java.lang.String>>
        Returns:
        the last element.
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<VALUE extends CursorValue<java.lang.String>>
      • hasPrev

        public boolean hasPrev()
        Specified by:
        hasPrev in interface Cursor<java.lang.String,​VALUE extends CursorValue<java.lang.String>>
        Returns:
        Is there a previous element in the collection?
      • next

        public VALUE next()
        Specified by:
        next in interface java.util.Iterator<VALUE extends CursorValue<java.lang.String>>
      • next

        public VALUE next​(int count)
        Description copied from interface: Cursor
        Returns the count next element in the iteration.
        Specified by:
        next in interface Cursor<java.lang.String,​VALUE extends CursorValue<java.lang.String>>
        Parameters:
        count - the offset
        Returns:
        the n'th next element in the iteration
      • prev

        public VALUE prev()
        Specified by:
        prev in interface Cursor<java.lang.String,​VALUE extends CursorValue<java.lang.String>>
        Returns:
        the previous element.
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<VALUE extends CursorValue<java.lang.String>>
      • setKey

        public void setKey​(java.lang.String key)
        Description copied from interface: Cursor
        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.
        Specified by:
        setKey in interface Cursor<java.lang.String,​VALUE extends CursorValue<java.lang.String>>
        Parameters:
        key - the key to search for