Interface LookaheadIterator

    • Method Detail

      • supportsHasNext

        boolean supportsHasNext()
        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)
        Returns:
        true if the hasNext() method is available
      • hasNext

        boolean hasNext()
        Determine whether there are more items to come. Note that this operation is stateless and it is not necessary (or usual) to call it before calling next(). It is used only when there is an explicit need to tell if we are at the last element.

        This method must not be called unless the result of supportsHasNext() is true.

        Returns:
        true if there are more items in the sequence