sequence in Kotlin

The sequence is similar to Java streams in the sense that they both serve as a data source and you can perform operations on them in a declarative (or functional) way. They are not data structures or storage. They are simply abstractions of the underlying source but with an added support for aggregate operations.