[ 
https://issues.apache.org/jira/browse/HBASE-12060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14145892#comment-14145892
 ] 

Lars Hofhansl commented on HBASE-12060:
---------------------------------------

Let's also not go over board here. The interator version of the loop is easier 
to read and we *only* have to replace this in hot code paths. In other places 
let's please leave the iterator notation.
(and who knows, javac might soon be able to do this optimization itself and 
we're left with a bunch of unreadable code and future committers will be 
jealous of we were smoking).


> Replace enhanced for statement with basic for statement where possible
> ----------------------------------------------------------------------
>
>                 Key: HBASE-12060
>                 URL: https://issues.apache.org/jira/browse/HBASE-12060
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Andrew Purtell
>              Labels: beginner, beginners
>
> Wherever we use the enhanced for construction:
> {noformat}
>     for ( FormalParameter : Expression ) Statement
> {noformat}
> where the Expression evaluates to an array or collection type that supports 
> random access, we can avoid creating iterator objects, unless we are also 
> using the iterator to remove items while iterating by using the basic for 
> statement instead:
> {noformat}
> for ( ForInit ; Expression ; ForUpdate ) Statement
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to