RFR(m) 2: 8072722: add stream support to Scanner

Paul Sandoz paul.sandoz at oracle.com
Thu Sep 10 20:55:28 UTC 2015


On 10 Sep 2015, at 22:22, Stuart Marks <stuart.marks at oracle.com> wrote:
>>> It'd be better to initialize expectedCount to modCount in constrocutor?
> 
> That's how I had it initially, but at Paul Sandoz' suggestion I delayed the initialization to the first call to tryAdvance().

Yes, it’s preferable to have a "late-binding” Spliterator, as is the case for Matcher and collections.

The “best-effort” implementation is more than sufficient given the extremely low probability of non-detection.

Paul.

>  This allows the Scanner's state to be modified after stream creation but before stream pipeline execution. This is the way that Paul's stream code in Matcher works. I'm not sure how important this is. Having Scanner be gratuitously different from Matcher seems like it would be irritating though.
> 





More information about the core-libs-dev mailing list