Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tonycheng93 opened this issue Aug 21, 2017 · 1 comment
Closed

Comments

@tonycheng93
Copy link

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指定类型了,也不能指定了

@Blankj
Copy link
Owner

Blankj commented Aug 21, 2017

失误了,好的,稍后更新

@Blankj Blankj closed this as completed Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants