哪个更好?
List list = ... //get list from somewhere
for (int i=0; list != null && i < list.size(); i++){
// ...
}
或者?
List list = ... //get list from somewhere
if (list != null){
for (int i = 0; i < list.size(); i++){
// ...
}
}
我从这里得到了这个想法:Scala 还是 Java?探索神话和事实