On Aug 1, 2013, at 4:45 PM, Henry Jen <[email protected]> wrote:
> In StremSpliterator:366, I assume the NULL check should be before if.
>
It saves a redundant check if the wrapping spliterator uses buffering, since
the tryAdvance will also check:
public void forEachRemaining(IntConsumer consumer) {
if (buffer == null && !finished) {
Objects.requireNonNull(consumer);
init();
ph.wrapAndCopyInto((Sink.OfInt) consumer::accept, spliterator);
finished = true;
}
else {
do { } while (tryAdvance(consumer));
}
}
> There are a couple
>
> if {
> }
> else if
>
> and
>
> try {
> }
> catch
>
> Isn't the style recommended to be on the same line?
>
Depends who you talk to :-) It's a style that is used in much of the stream
implementation.
Paul.