Kotlin, Programming, Software Development, Functional Programming, Coding.
Using a sequence — val numbersSeq = numbers.asSequence() val resultSeq = numbersSeq.map { it * it } .filter { it % 5 == 0 } .first() println(resultSeq) // 25 With sequences, each number is squared, checked if it’s divisible by 5, and then the process halts when the first such number is found. So,