Home > Back-end >  [do not understand ask] java8 new feature System. Out: what println.
[do not understand ask] java8 new feature System. Out: what println.

Time:05-12

Contact Java rectified, first saw the printing way...

This is directly in the forEach loop inside the function array, and the way you introduced to print

If you want to return instead of printing, how to return big advice please
Try (Stream Lines=Files. The lines (filePath)) {

List FilteredLines=lines
The filter (s - & gt; S.c ontains (" password "))
Collect (Collectors. ToList ());

FilteredLines. ForEach (System. Out: : println ).

} the catch (IOException e) {
e.printStackTrace();//just test cases, production environment don't do that exception handling
}

CodePudding user response:

Lambda expressions, function shorthand, before we need new an object to call methods, and then through the call object method, now have the lambda expressions, by the name of the class: : call the method name

CodePudding user response:

Like System. Out: : println and Stream supporting it,
  • Related