Raw String Literal Library Support
Paul Sandoz
paul.sandoz at oracle.com
Tue Mar 13 23:22:33 UTC 2018
> On Mar 13, 2018, at 3:49 PM, John Rose <john.r.rose at oracle.com> wrote:
>
> On Mar 13, 2018, at 6:47 AM, Jim Laskey <james.laskey at oracle.com> wrote:
>>
>> …
>> A. Line support.
>>
>> public Stream<String> lines()
>>
>
> Suggest factoring this as:
>
> public Stream<String> splits(String regex) { }
+1
This is a natural companion to the existing array returning method (as it was the case on Pattern when we added splitAsStream), where one can use a limit() operation to achieve the same effect as the limit parameter on the array returning method.
> public Stream<String> lines() { return splits(`\n|\r\n?`); }
>
See also Files/BufferedReader.lines. (Without going into details Files.lines has some interesting optimizations.)
Paul.
More information about the core-libs-dev
mailing list