RFR 8037106: Optimize Arrays.asList(...).forEach
Paul Sandoz
paul.sandoz at oracle.com
Mon Mar 17 15:41:45 UTC 2014
On Mar 15, 2014, at 12:17 AM, Ulf Zibis <Ulf.Zibis at CoSoCo.de> wrote:
> Am 14.03.2014 17:10, schrieb Paul Sandoz:
>>> I'm willing to believe for-loop over array is as efficient as fortran-style loop
>>>
>>> + for (E e : a) {
>>> + action.accept(e);
>>> + }
>>>
>> Yeah, i previously went through a whole bunch of code replacing such fortran-style loops with 'foreach' style based on automated code analysis.
>
> But wouldn't this help a little more? :
> + final E[] a = this.a;
> + for (E e : a) {
> + action.accept(e);
> + }
>
Thanks, i changed it to that.
>
> I more like the given style with less spaces:
> 3854 for (int i=0; i<a.length; i++)
> It better visualizes the 3 parts of the for statement.
>
Subjectively that irritates my eyes :-) non-subjectively it is inconsistently applied.
Paul.
More information about the core-libs-dev
mailing list