8000 io-to-data.15 : Writer.appendLines · java-to-kotlin/code@54eb49b · GitHub
[go: up one dir, main page]

Skip to content

Commit 54eb49b

Browse files
Duncan McGregordmcg
authored andcommitted
io-to-data.15 : Writer.appendLines
1 parent 368a55b commit 54eb49b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
package travelator.marketing
22

3+
import java.io.Writer
34

45
fun main() {
56
System.`in`.reader().use { reader ->
67
System.out.writer().use { writer ->
7-
generate(
8-
reader.readLines()
9-
).forEach { line ->
10-
writer.appendLine(line)
11-
}
8+
writer.appendLines(
9+
generate(reader.readLines())
10+
)
1211
}
1312
}
13+
}
14+
15+
fun Writer.appendLines(lines: Sequence<CharSequence>): Writer {
16+
return this.also {
17+
lines.forEach(this::appendLine)
18+
}
1419
}

0 commit comments

Comments
 (0)
0