inline fun forEach(action: (T?) -> Unit) {
val iter = iterator()
var it = iter.next()
while(it != null) {
action.invoke(p1 = it)
it = iter.next()
}
}
a
Alowaniak
04/15/2019, 5:46 AM
Afaict it's not a correct implementation
Iterator#next throws a NoSuchElementException if there's no element iirc, you would have to use Iterator#hasNext