Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. fun <R> File.mapForEachLine(transform: (String) -> R): List<R> {
  2. val lines = BufferedReader(InputStreamReader(FileInputStream(this))).lines()
  3. val list = ArrayList<R>(lines.count().toInt())
  4. for (item in lines)
  5. list.add(transform(item))
  6. return list
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement