Pattern.splitAsStream/asPredicate
Brian Goetz
brian.goetz at oracle.com
Wed Apr 24 10:13:35 PDT 2013
There definitely could be more to this. For example, a common usage pattern for matching is:
while (more) {
// get the next match
// get the stuff between the last match and the start of this match
// do something with that
// do something with the current match
}
So while getting the matches is good, getting at the stuff between the matches is also sometimes useful. Is there an easy way to do that, such as providing a Stream<Match>?
There's an easy way for streams like this to be never-parallel -- create them from a Spliterator whose trySplit always returns null. Then, even parallel execution will always be serial. I don't think there's a need for an abstraction for that -- just build off a non-splittable iterator.
But, there may also be some parallelism to extract, if the post-processing on a match is high-Q. Then you might still be able to overcome the sequentiality of generating matches if the per-match post processing is high enough.
On Apr 24, 2013, at 11:23 AM, Joe Bowbeer wrote:
> Makes sense to me that one might want to generate a stream from a Pattern. Is there more to this than splitAsStream?
>
> It's also interesting to consider the absence of parallel stream options at this and the other stream factory sites.
>
>
>
>
> On Apr 22, 2013 9:10 AM, "Paul Sandoz" <paul.sandoz at oracle.com> wrote:
> Hi,
>
> It seems useful to provide an ability to create a stream from matches of a pattern, plus as a bonus create a predicate for matches of a pattern.
>
> See below for more details:
>
> http://cr.openjdk.java.net/~psandoz/lambda/jdk-8012646/webrev/
>
> Thoughts?
>
> Paul.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20130424/146a6826/attachment.html
More information about the lambda-libs-spec-experts
mailing list