OK, I was playing with some code and got very unex...
# announcements
e
OK, I was playing with some code and got very unexpected results
Copy code
val path = FileSystems.getDefault().getPath("D:\\Scanned");

    var files = listOf<Path>()

    class fileVisitor : SimpleFileVisitor<Path>() {

        override fun visitFile(path: Path, fileAttributes: BasicFileAttributes) : FileVisitResult {
            println(path)
            files = files + path
            return CONTINUE
        }
    }

    walkFileTree(path, fileVisitor())

    println(files.size)

    files.forEach { println("file: ${it.fileName}") }
lists do not behave in the way I expected.
Copy code
D:\Scanned\2014-04-08 Board Letter.pdf
D:\Scanned\2014-05-25 Kay PoA.pdf
D:\Scanned\2014-05-25 Kay TD.pdf
6
file: Scanned
file: 2014-04-08 Board Letter.pdf
file: Scanned
file: 2014-05-25 Kay PoA.pdf
file: Scanned
file: 2014-05-25 Kay TD.pdf