Class ArrayIterator

    • Field Detail

      • index

        protected int index
      • start

        protected int start
      • end

        protected int end
    • Constructor Detail

      • ArrayIterator

        public ArrayIterator()
    • Method Detail

      • makeSliceIterator

        public abstract SequenceIterator makeSliceIterator​(int min,
                                                           int max)
        Create a new ArrayIterator over the same items, with a different start point and end point
        Parameters:
        min - the start position (1-based) of the new ArrayIterator relative to the original
        max - the end position (1-based) of the last item to be delivered by the new ArrayIterator, relative to the original. For example, min=2, max=3 delivers the two items ($base[2], $base[3]). Set this to Integer.MAX_VALUE if there is no end limit.
        Returns:
        an iterator over the items between the min and max positions
      • supportsHasNext

        public boolean supportsHasNext()
        Description copied from interface: LookaheadIterator
        Ask whether the hasNext() method can be called. This method must be called before calling hasNext(), because some iterators implement this interface, but only support look-ahead under particular circumstances (this is usually because they delegate to another iterator)
        Specified by:
        supportsHasNext in interface LookaheadIterator
        Returns:
        true if the LookaheadIterator.hasNext() method is available
      • position

        public int position()
        Description copied from interface: FocusIterator
        Get the current position. This will usually be zero before the first call on next(), otherwise it will be the number of times that next() has been called. Once next() has returned null, the preferred action is for subsequent calls on position() to return -1, but not all existing implementations follow this practice. (In particular, the EmptyIterator is stateless, and always returns 0 as the value of position(), whether or not next() has been called.)

        This method does not change the state of the iterator.

        Specified by:
        position in interface FocusIterator
        Returns:
        the current position, the position of the item returned by the most recent call of next(). This is 1 after next() has been successfully called once, 2 after it has been called twice, and so on. If next() has never been called, the method returns zero. If the end of the sequence has been reached, the value returned will always be <= 0; the preferred value is -1.