asKoneSequence
Converts this KoneIterator to a KoneSequence by wrapping it.
Be aware that this sequence returns the same iterator as it has acquired on each KoneSequence.iterator call. Hence,
val list = KoneList.of(1, 2, 3)
val theSequence = list.asKoneSequence()
println(theSequence.take(1).toKoneList()) // prints "1"
println(theSequence.take(1).toKoneList()) // prints "1" again, because a new iterator was created and used!
val theSequence = list.iterator().asKoneSequence()
println(theSequence.take(1).toKoneList()) // prints "1"
println(theSequence.take(1).toKoneList()) // prints "2", not "1", because wrapped iterator's state changed!It's a good method for one-time wrapping of the iterator in a call chain, but it's bad for reusing the sequence value. If you need cached variant of the iterator-based sequence, use KoneSequence.cached. If you need to wrap an iterator that is acquired from an iterable, apply KoneIterable.asKoneSequence on the iterable straight.
Receiver
The iterator to wrap into a sequence.
Return
A KoneSequence that wraps this iterator.
Type Parameters
The type of elements.
Converts this KoneIterable to a KoneSequence by returning this iterable's iterators.
Receiver
The iterable to wrap into a sequence.
Return
A KoneSequence that wraps this iterable's iterator.
Type Parameters
The type of elements.