Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
This is not recommended because it didn't comply with the main purpose of using exception, which is to detect and recover \[[EXC03-J. Try to gracefully recover from system errors|EXC03-J. Try to gracefully recover from system errors]\]. The normal logical flow of reaching the end of array is treated as an exception here, which has an inverse effect on readability and comprehension. Besides, exception-based idiom is far slower than standard code block in Java VM. It will prevents certain optimizations that JVM would otherwise perform.

Compliant Solution

A standard way of using for idiom can solve the problem.

Code Block
bgColor#ccccff
for (int i=0; i<a.length; i++) {
    a[i].f();
}

...