elect
01/23/2021, 8:45 PM.java
files given a root folder to redirect to javac
. Isn't there a nicer kotlin alternative to this?
val sources = Files.find(Paths.get(srcDir), 999, { path, attr ->
attr.isRegularFile && path.toString().endsWith(".java")
}).map { it.toString() }.collect(Collectors.joining(" "))
Files.find
returns a Stream<Path!>!
and I need to go trough map
+ collect
+ Collectors
instead something more conciseDominaezzz
01/23/2021, 9:03 PMFile(srcDir).walk().maxDepth(999)
.filter { it.isFile && it.extension == "java" }
.joinToString(" ") { it.toString() }
elect
01/23/2021, 9:10 PMRuckus
01/24/2021, 12:05 AMit.toString()
is the default behavior for joinToString
, so you could just use .joinToString(" ")