How to use File.walkBottomUp()?



I’m trying to make use of File.walkBottomUp(), but IntelliJ IDEA 2017.1 keeps on suggesting me to import from Java 8 for it, which does not have walkBottomUp(). Also import does not work. How am I supposed to use that function?

Thanks in advance!


Ok, so I guess is the right import as Kotlin seems to amend the class with walkBottomUp() via an extension function, but for some reason extension functions do not seem to work for me. Any idea why?


What do you mean by “do not seem to work”?


Without knowing what symptoms you’re seeing, a general tip I use is to try your code with - It will help you figure out if the problem is your code or your setup.

… although as soon as I mention this I realize you’re just going to get AccessControlException if you try to do File io in their sandbox.


Sorry for not being more specific. What I meant was that the code does not compile because the symbol is not being found. But I figured it out: I misread the File.walkBottomUp() function to be a static one. Using it like File(dirname).walkBottomUp() works fine now.