July 2018
Intermediate to advanced
266 pages
7h 11m
English
As mentioned previously, to read elements from an iterator you can use next(). For example, this code will simply print each of the elements:
fun main(args: Array<String>) { val iterator : Iterator<Any> = buildIterator { yield(1) yield(10L) yield("Hello") } println(iterator.next()) println(iterator.next()) println(iterator.next())}
Shown as follows:

Read now
Unlock full access