202010-08 使用java8 API遍历过滤文件目录及子目录和隐藏文件示例详解 1.使用Files.list()迭代目录及其子目录文件Files.list()可以迭代目录及其子目录文件Files.list(Paths.get("."))//当前目录.forEach(System.out::println);输出:.\filename1.txt.\directory1.\filename2.txt.\Employee.java2.使用filter表达式过滤文件过滤器函数引用,isRegularFile表示普通文件Files.list(Paths.get(".")).filter(Files::isRegularFile)//过滤器:只保留普通文件,过滤掉文件目录.forEach(System.out::... 继续阅读 >