Hello! Thank you for clarification. As far as I know currently JIT-compiled null checks are almost always implicit (via trapped page-fault). Well, ok, I'm not a Hotspot expert (probably for C1 this still matters). I will keep this code as is.
Webrev was not changed: http://cr.openjdk.java.net/~tvaleev/webrev/8148748/r1/ Any more reviews, please? With best regards, Tagir Valeev. MB> On Wed, Feb 3, 2016 at 4:20 AM, Tagir F. Valeev <amae...@gmail.com> wrote: >> Some more thoughts about forEachRemaining: >> >> To me it seems that >> if ((a = lst.elementData) != null) >> is a redundant check as well as in current ArrayList implementation >> elementData is never null. So it can be replaced with simple >> assignment. MB> The null check for something that is provably non-null is a sign of MB> the hand of Doug Lea. MB> I'm often tempted to try to remove them from j.u.concurrent as well, MB> but I resist. MB> They may help hotspot generate better code.