Class ConcatenatingIntIterator

  • All Implemented Interfaces:
    IntIterator

    public class ConcatenatingIntIterator
    extends Object
    implements IntIterator
    An iterator over nodes, that concatenates the nodes returned by two supplied iterators.
    • Constructor Detail

      • ConcatenatingIntIterator

        public ConcatenatingIntIterator​(IntIterator first,
                                        Supplier<IntIterator> second)
        Create an iterator that concatenates the results of two supplied iterator. The second iterator isn't created until it is actually needed.
        Parameters:
        first - the first iterator
        second - a function that can be called to supply the second iterator
    • Method Detail

      • hasNext

        public boolean hasNext()
        Description copied from interface: IntIterator
        Test whether there are any more integers in the sequence; and change the state of the iterator so a call on IntIterator.next() delivers the next integer.

        The effect of calling #hasNext() a second time without an intervening call on #next() is undefined.

        Specified by:
        hasNext in interface IntIterator
        Returns:
        true if there are more integers to come
      • next

        public int next()
        Get the next item in the sequence.
        Specified by:
        next in interface IntIterator
        Returns:
        the next Item. If there are no more items, return null.