Performance should not be a concern, null checking is highly optimized by the 
JIT and is anyway required when the consumer is accessed in the loop. 

It’s probably an oversight but FWIW these internal iterators are never exposed 
directly and are wrapped in spliterators and those wrappers will perform 
dominating null checks.

Paul.


> On Jun 5, 2018, at 1:17 PM, Андрей Турбанов <turban...@gmail.com> wrote:
> 
> Hello.
> 
> I observe that implementations of `forEachRemaining` method inside
> java.lang.CharSequence doesn't always compare IntConsumer parameter with
> null.
> Is there any reason why there is no nonNull check? Performance?
> 
> Andrey Turbanov.

Reply via email to