<@U0AAQKT9Q> commented on <@U0Q2YA9BK>’s file <htt...
# getting-started
u
@ilya.gorbunov commented on @dierre’s file https://kotlinlang.slack.com/files/U0Q2YA9BK/F5W5DV5AB/hello__do_you_think_there_is_a_more_idiomatic_way_to_express_this_method_.kt: 1. Replace
line.split(", ".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
with just
line.split(", ")
2. you can use
File.useLines
function and
map
the returned sequence instead of filling the mutable list by hand:
Copy code
return File(fileName).useLines { lines ->
    lines.skip(1).map { line ->
        // create employee from line
    }.toList()
}