Blankj / AndroidStandardDevelop

:star2: Best practices in Android develop(final).

Home Page:https://blankj.com/2017/03/08/android-standard-dev-final

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"尽量减少对变量的重复计算"这一小节的一个小错误

tonycheng93 opened this issue · comments

10 其他的一些规范

    14 .尽量减少对变量的重复计算;

    如下面的操作:
       for (int i = 0; i < list.size(); i++) {
            ...
      }

建议替换为:

for (int i = 0, int length = list.size(); i < length; i++) {
    ...
}

这里应该改为

for (int i = 0, length = list.size(); i < length; i++) {
    ...
}

不需要再为length指定类型了,也不能指定了

失误了,好的,稍后更新