/**
* BufferedReader 缓存读取流
* trim 清除空格
* filter 过滤
* e->e Lambda表达式
* lines 是流,只能调用一次
*/

public class File6 {
public static void main(String[] args) throws FileNotFoundException {
String path = "E:\\byshop\\src\\main\\java\\cn\\by\\dao\\GoodsDao.java";
BufferedReader br = new BufferedReader(new FileReader(path));
System.out.println(br.lines().filter(e->e.trim().length()>0).count());
}
}
posted on 2021-01-20 21:52  liuyunche  阅读(147)  评论(0编辑  收藏  举报