Klitos Kyriacou
01/03/2025, 5:30 PMIntStream
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>
.Ruckus
01/03/2025, 5:43 PMInterator
?ephemient
01/03/2025, 7:55 PMinterface 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