注:经验证可行。
public class listDealer{
public List<String> list1;public List<String> list2;
public List<String> list3;
public String toString(){
String list1Str = "";
String list2Str = "";
String list3Str = "";
//foreach
for(String s : list1)
list1Str += s+"\n";
Iterator it = list2.iterator();
while(it.hasNext()){
list2Str += it.next()+"\n";
}
for(int i=0; i<list3.size();i++){
list3Str += list3.get(i)+"\n";
}
}
}