On 10 Sep 2015, at 22:22, Stuart Marks <stuart.ma...@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. >