//1. filter line 3 //2. convert all content to upper case //3. convert it into a List list &#61; stream.filter(line ->!line.startsWith("line3")).map(String::toUpperCase).collect(Collectors.toList());//不处理&#xff0c;指定编码的话 Charset c &#61; Charset.forName("UTF-8"); //System.out.println(Charset.isSupported("UTF-8")); try(Stream<String> stream &#61; Files.lines(Paths.get(filePath), c)){List<String> raws &#61;newArrayList<>();raws &#61; stream.collect(Collectors.toList());for(String s:raws){System.out.println(s);} }catch(IOException e){e.printStackTrace(); }