Package generic.stl

Interface IteratorSTL<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void assign​(IteratorSTL<T> otherIterator)
      'Assigns' this iterator to be equivalent to the given iterator.
      IteratorSTL<T> copy()
      Creates a copy of this iterator.
      IteratorSTL<T> decrement()
      Devance the iterator to the previous position.
      IteratorSTL<T> decrement​(int n)
      Devances the iterator n positions.
      T get()
      Returns the current value of the iterator.
      IteratorSTL<T> increment()
      Advances the iterator to the next position.
      IteratorSTL<T> increment​(int n)
      Advances the iterator n positions.
      void insert​(T value)
      Inserts the given value at the current position (the current value will be pushed to the next value).
      boolean isBegin()
      Returns true if the iterator is positioned on the first first element of the collection.
      boolean isEnd()
      Returns true if the iterator is positioned past the last element of the collection.
      void set​(T value)
      Sets the current value of the iterator to the given value.
    • Method Detail

      • get

        T get()
        Returns the current value of the iterator.
        Returns:
        the current value of the iterator.
        Throws:
        java.lang.IndexOutOfBoundsException - if the iterator is positioned before the first value or after the last value.
      • set

        void set​(T value)
        Sets the current value of the iterator to the given value.
        Parameters:
        value - the value to set at the iterator position
        Throws:
        java.lang.IndexOutOfBoundsException - if the iterator is positioned befor the first value or after the last value.
      • increment

        IteratorSTL<T> increment()
        Advances the iterator to the next position.
        Returns:
        a reference to the iterator itself
        Throws:
        java.lang.IndexOutOfBoundsException - if the the iterator is already past the last element.
      • increment

        IteratorSTL<T> increment​(int n)
        Advances the iterator n positions.
        Returns:
        a reference to the iterator itself
        Throws:
        java.lang.IndexOutOfBoundsException - if the n value pushes past the end of the collection.
      • decrement

        IteratorSTL<T> decrement()
        Devance the iterator to the previous position. This method is only supported in bidirectional iterators.
        Returns:
        a reference to the iterator itself
      • decrement

        IteratorSTL<T> decrement​(int n)
        Devances the iterator n positions.
        Returns:
        a reference to the iterator itself
        Throws:
        java.lang.IndexOutOfBoundsException - if the n value pushes past the beginning of the collection
      • isBegin

        boolean isBegin()
        Returns true if the iterator is positioned on the first first element of the collection. If the collection is empty, this will always return false.
        Returns:
        true if the iterator is positioned on the first element of the collection.
      • isEnd

        boolean isEnd()
        Returns true if the iterator is positioned past the last element of the collection. If the collection is empty, this will always return true.
        Returns:
        true if the iterator is positioned past the last element of the collection.
      • insert

        void insert​(T value)
        Inserts the given value at the current position (the current value will be pushed to the next value). The iterator will be positioned on the new value.
        Parameters:
        value - the value to insert into the collection.
        Throws:
        java.lang.IndexOutOfBoundsException - if the iterator is positioned before the first item.
      • copy

        IteratorSTL<T> copy()
        Creates a copy of this iterator.
        Returns:
        a copy of this iterator.
      • assign

        void assign​(IteratorSTL<T> otherIterator)
        'Assigns' this iterator to be equivalent to the given iterator. This is equivalent to C++'s '=' overloading mechanism
        Parameters:
        otherIterator - The iterator to copy