Learn R Programming

itertools (version 0.1-3)

ihasNext: Create an iterator that supports the hasNext method

Description

ihasNext is a generic function that indicates if the iterator has another element.

Usage

ihasNext(iterable)

Arguments

iterable
an iterable object, which could be an iterator.

Value

An ihasNext iterator that wraps the specified iterator and supports the hasNext method.

Examples

Run this code
  it <- ihasNext(c('a', 'b', 'c'))
  while (hasNext(it))
    print(nextElem(it))

Run the code above in your browser using DataLab