Class ArrayIteratorAdapter<T>

  • Type Parameters:
    T - type of array element
    All Implemented Interfaces:
    java.util.Iterator<IModel<T>>

    public abstract class ArrayIteratorAdapter<T>
    extends java.lang.Object
    implements java.util.Iterator<IModel<T>>
    Iterator over an array. Implementation must provide model(Object) method to wrap each item in a model before it is returned through next() method.
    Author:
    Igor Vaynberg (ivaynberg)
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()  
      protected abstract IModel<T> model​(T object)
      This method is used to wrap the provided object with an implementation of IModel.
      IModel<T> next()  
      void remove()  
      void reset()
      Resets the iterator position back to the beginning of the array
      • 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
    • Constructor Detail

      • ArrayIteratorAdapter

        public ArrayIteratorAdapter​(T[] array)
        Constructor
        Parameters:
        array -
    • Method Detail

      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<T>
        See Also:
        Iterator.remove()
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<T>
        See Also:
        Iterator.hasNext()
      • next

        public IModel<T> next()
        Specified by:
        next in interface java.util.Iterator<T>
        See Also:
        Iterator.next()
      • reset

        public void reset()
        Resets the iterator position back to the beginning of the array
      • model

        protected abstract IModel<T> model​(T object)
        This method is used to wrap the provided object with an implementation of IModel. The provided object is guaranteed to be returned from the delegate iterator.
        Parameters:
        object - object to be wrapped
        Returns:
        IModel wrapper for the object