for ( Iterator iter = list.iterator(); iter.hasNext(); ) {
String sub = iter.next().toString();
if ( 0 == index ) {
buf.append(sub);
} else {
buf.append("," + sub);
}
index++;
}应该和下边一样的,我想问一下,第二项应该是最大值的比较吧,这样写没有问题吗?Iterator iter = list.iterator();
while( iter.hasNext()==true) {
String sub = iter.next().toString();
if ( 0 == index ) {
buf.append(sub);
} else {
buf.append("," + sub);
}
index++;
}那个更加好一些
String sub = iter.next().toString();
if ( 0 == index ) {
buf.append(sub);
} else {
buf.append("," + sub);
}
index++;
}应该和下边一样的,我想问一下,第二项应该是最大值的比较吧,这样写没有问题吗?Iterator iter = list.iterator();
while( iter.hasNext()==true) {
String sub = iter.next().toString();
if ( 0 == index ) {
buf.append(sub);
} else {
buf.append("," + sub);
}
index++;
}那个更加好一些
==true不用写~~
其他没啥区别~~,不用在这上面费劲计较