RFR: 8155600 - Performance optimization of Arrays.asList().iterator()

Attila Szegedi szegedia at gmail.com
Thu Apr 28 14:08:47 UTC 2016


On Thu, Apr 28, 2016 at 3:52 PM, Aleksey Shipilev <
aleksey.shipilev at oracle.com> wrote:

>  *) next(): Missing braces in throw new NSEE() block;
>  *) next(): Why loading this.a into local?


I agree with Aleksey but I'd go as far as to say that not only this.a is
unnecessary, but i as well. The body of next() looks too elaborate. This
seems equivalent and concise:

  if (cursor >= a.length) {
      throw new NoSuchElementException();
  }
  return a[cursor++];

Attila.



More information about the core-libs-dev mailing list