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

Stuart Marks stuart.marks at oracle.com
Fri Sep 18 21:56:42 UTC 2015



On 9/17/15 12:11 AM, Peter Levart wrote:
> As an alternative to additional boolean field, you could use one bit of
> expectedCount/modCount int field(s):
>
> - let initial value of expectedCount be 1 (odd value)
> - instead of (expectedCount >= 0) ==> (expectedCount != 1)
> - let initial value of modCount be 0 (even value)
> - instead of modCount++ ==> modCount += 2;

Hi Peter,

This certainly avoids the overflow issues, but I think much of Sherman's concern 
is over the clarity of the code. I'm not sure that we're so concerned about an 
additional field in the spliterator instance that we'd steal a bit from 
expectedCount.

Still, I'll link this thread to the new bug to make sure it doesn't get lost.

https://bugs.openjdk.java.net/browse/JDK-8136673

s'marks





More information about the core-libs-dev mailing list