RFR 8037106: Optimize Arrays.asList(...).forEach
Ulf Zibis
Ulf.Zibis at CoSoCo.de
Fri Mar 14 23:17:42 UTC 2014
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);
+ }
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.
-Ulf
More information about the core-libs-dev
mailing list