Merge pull request #65 from udalov/master

File.listFiles(filter)
This commit is contained in:
James Strachan
2012-06-15 03:38:00 -07:00
2 changed files with 24 additions and 0 deletions
+9
View File
@@ -202,3 +202,12 @@ fun File.readLines(charset : String = "UTF-8") : List<String> {
return rs
}
/**
* Returns an array of files and directories in the directory that satisfy the specified filter.
*/
fun File.listFiles(filter : (file : File) -> Boolean) : Array<File>? = listFiles(
object : FileFilter {
override fun accept(file: File?) = filter(file!!)
}
) as Array<File>?