Class ConcatenatingIntIterator

  • All Implemented Interfaces:
    IntIterator

    public class ConcatenatingIntIterator
    extends java.lang.Object
    implements IntIterator
    An iterator over nodes, that concatenates the nodes returned by two supplied iterators.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      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.
      int next()
      Get the next item in the sequence.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConcatenatingIntIterator

        public ConcatenatingIntIterator​(IntIterator first,
                                        java.util.function.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.