public inline fun <T> Reader.useLines(block: (Sequence<String>) -> T): T =
buffered().use { block(it.lineSequence()) }
val reader: Reader = ...
reader.buffered().use {
val sequence : Sequence<String> = it.lineSequence()
...
}
↓
val reader: Reader = ...
reader.useLines {
val sequence : Sequence<String> = it
...
}
0 件のコメント:
コメントを投稿