Class NestedIterator<E>

  • All Implemented Interfaces:
    Iterator<E>

    public class NestedIterator<E>
    extends Object
    implements Iterator<E>
    This class implements the Iterator interface for iterating multiple collections as if it was one big collection.
    Version:
    2.0
    Author:
    Nicklas
    Last modified
    $Date: 2015-05-20 14:43:14 +0200 (on, 20 maj 2015) $
    • Field Detail

      • collections

        private final Collection<? extends E>[] collections
        The array to iterate.
      • index

        private int index
        The index of the next collection to return.
      • current

        private Iterator<? extends E> current
        The current iterator.
    • Constructor Detail

      • NestedIterator

        @SafeVarargs
        public NestedIterator​(Collection<? extends E>... collections)
        Create a new ArrayIterator object.
        Parameters:
        collections - An array of Collection objects.