Just been thinking... Java has `IntStream` and `Lo...
# random
k
Just been thinking... Java has
IntStream
and
LongStream
which avoids boxing compared to
Stream<Integer>
and
Stream<Long>
. Why doesn't Kotlin have
IntSequence
and
LongSequence
? On the other hand, Kotlin has
IntIterator
which avoids boxing, while Java only has
Iterator<Integer>
.
👀 1
r
More importantly, why wasn't it called
Interator
?
😄 4
😂 3
e
so to an extent this would be easy:
Copy code
interface IntSequence : Sequence<Int> {
    override fun iterator(): IntIterator
}
the problem is that without
fun iterator(block suspend IntSequenceScope.() -> Unit): IntIterator
+
fun sequence(block suspend: IntSequenceScope.() -> Unit): IntSequence
, you don't have useful ways to construct one, and all of the usual extension functions would result in boxing too
👍 1