JDK-8200380 : String::lines
  • Type: New Feature
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Fix Versions: 11
  • Submitted: 2018-03-28
  • Updated: 2019-05-30
  • Resolved: 2018-05-22
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Description
String::lines instance method that returns a Stream<String> with elements composed of substrings from the original string delimited by any recognized new line character sequence.

Note: String::lines() behaviour mimics BufferedReader::lines() as it treats new line character sequences as line terminators. 

Unlike String::split, String::lines provides better performance by supplying elements lazily and by fast search of new line character sequences.