`// This rule specifies whether you are allowed to have
// complex expressions in loops.
// A complex expression is usually a method call which
// could be very time/resource intensive. Therefore you
// should assign the return value to a variable and
// check agains this.
...
ComplexObject co = new ComplexObject();
// this can be very time intensive
for (int i = 0; i < co.doCalculation(); i++})
{
// do something
}
// this approach is better
int result = co.doCalculation();
` `for (int i = 0; i < result; i++})
{
// do something
}
` `// or this one
` `for (int i = 0,` `result = co.doCalculation()``;
i < result; i++})
{
// do something
}
` ``