How to make stream pipeline simpler
I think my code needs improvement. I use object allSummaryTSTLog both in the stream's filter() and map() stages, so I have to call File.listFiles twice: public static List<Test> ParserPath(List<String> allLogPath) { FilenameFilter filter = new MyFilter("Summary_TSTLog"); return allLogPath.parallelStream().filter(path -> { File testPath = new File(path); if (!testPath.isDirectory()) { MyLog.log.info("test path : [" + path + "] is not exist, continue"); return false; } File[] allSummaryTSTLog = testPath.listFiles(filter); if (allSummaryTSTLog == null || allSummaryTSTLog.length == 0) { MyLog.log