dirk.dittert
12/29/2016, 10:36 PMimport java.nio.file.Files
import java.nio.file.LinkOption
import java.nio.file.Path
import java.util.stream.Collectors
fun one(dir: Path) {
val currentFiles = Files.list(dir).filter {
Files.isRegularFile(it, LinkOption.NOFOLLOW_LINKS)
}.map {
it.fileName.toString()
}.collect(Collectors.toSet())
two(currentFiles, setOf<String>())
// ^^^^^^^^^^^^ Required Set, Found MutableSet
}
fun two(files: Set<String>, dirs: Set<String>) {
// this is actually declared in Java, thus there is no distinction between Set and MutableSet
}