File.listFiles(filter)

This commit is contained in:
Alexander Udalov
2012-06-04 17:41:28 +04:00
parent 36ab7d88b5
commit d296d64027
+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>?