Started learning kotlin. I had a question. Under the hood what data structures or processes are used for Kotlin sequence so that it avoids creating intermediary temporary objects. Any explanation or links would be helpful. Thank you
It uses a decorator pattern on the iterator. You can view all the decorators for each operation (filter
→ FilteringSequence, map
→ TransformingSequence, etc) here: kotlin/Sequences.kt at master · JetBrains/kotlin · GitHub