Does This Iterator Have A Next Element

Description

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

Usage

1
2
3
4
hasNext(obj, ...)

## S3 method for class 'ihasNext'
hasNext(obj, ...)

Arguments

obj

an iterator object.

...

additional arguments that are ignored.

Value

Logical value indicating whether the iterator has a next element.

Examples

1
2
3
  it <- ihasNext(iter(c('a', 'b', 'c')))
  while (hasNext(it))
    print(nextElem(it))