traditional for loop, which use indexes: pattern description

Ruslan Shevchenko rssh at gradsoft.com.ua
Sun Apr 26 08:03:58 PDT 2009


 Good day, community.

It's about proposal about adding for of loop with access for index value.
http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/000737.html

Patterns can be reviewed at
http://redmine.gradsoft.ua/repositories/entry/javachecker/trunk/JavaChecker/etc/checkers_coin.def

So, what statistics we need:
 1) How many for traditional loops we have at all.
 2) How many for loops have form:

 for(int i=0; i<x.length; ++i)
 or
 for(int i=0; i<x.size(); ++i)
 or
 i++ instead ++i
 or
 i=0 instead int i=0
in all combinations.
 All of those loops we
So, how many such loops we have ? -- near 1/3 of all traditional loops.

 3) for, where condition is like it.next()
 4) for and while, where condition like it.next and which call remove.

Sum of 2 and 4 will give us number of optimizations for index loop proposal

I guess this is cover, but correct me If I wrong.

Regards !








More information about the coin-dev mailing list