Или на один `map` короче: ``` val result = root...
# russian
b
Или на один
map
короче:
Copy code
val result = roots.asSequence()
            .map { root -> File(root, fileName).let { file -> if (file.exists()) file else null } }
            .filterNotNull()
            .firstOrNull()
g
Copy code
.map { root -> File(root, fileName).let { file -> if (file.exists()) file else null } }
            .filterNotNull()
можно заменить на:
Copy code
.map { root -> File(root, fileName).takeIf { it.exists() }