Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun <R> File.mapForEachLine(transform: (String) -> R): List<R> {
- val lines = BufferedReader(InputStreamReader(FileInputStream(this))).lines()
- val list = ArrayList<R>(lines.count().toInt())
- for (item in lines)
- list.add(transform(item))
- return list
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement