Interface IntegerIterator


  • public interface IntegerIterator
    An iterator for a list of integer's.
    Author:
    Tobias Downer
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Returns true if this list iterator has more elements when traversing the list in the forward direction.
      boolean hasPrevious()
      Returns true if this list iterator has more elements when traversing the list in the reverse direction.
      int next()
      Returns the next element in the list.
      int previous()
      Returns the previous element in the list.
      void remove()
      Removes from the list the last element returned by the iterator.
    • Method Detail

      • hasNext

        boolean hasNext()
        Returns true if this list iterator has more elements when traversing the list in the forward direction. (In other words, returns true if next would return an element rather than throwing an exception.)
      • next

        int next()
        Returns the next element in the list. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)
      • hasPrevious

        boolean hasPrevious()
        Returns true if this list iterator has more elements when traversing the list in the reverse direction. (In other words, returns true if previous would return an element rather than throwing an exception.)
      • previous

        int previous()
        Returns the previous element in the list. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)
      • remove

        void remove()
        Removes from the list the last element returned by the iterator. This method can be called only once per call to next. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.

        Some implementations of IntegerIterator may choose to not implement this method, in which case an appropriate exception is generated.