Skip to content

Commit

Permalink
collect size
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyzzz committed Feb 19, 2021
1 parent 589b40d commit 5cdc5db
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/FilesSize.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import java.nio.file.Files
import java.nio.file.Path
import java.util.stream.Collectors

fun main() {
val home = Path.of("/Users/jonnyzzz/Work/intellij-community")
val r = Files.walk(home).parallel()
.filter { Files.isRegularFile(it) }
.filter {
val name = it.fileName.toString()
name.endsWith(".java") ||
name.endsWith(".kt")
}.map { Files.size(it) }.collect(Collectors.summingLong { it })

println("Java + Kotlin size: $r")
}

0 comments on commit 5cdc5db

Please sign in to comment.