在循環中,我做了一些動作,然後得到並添加字符串到列表1 循環後:list1包含2個字符串:好吧 現在,在另一個循環中,我得到每個迭代的價值,它返回一個字符串和我想檢查列表1中的字符串不提供第二:比較java列表
for(inti=0;i<nb;i++){
value= table.getValue(i);
list1.add(value);
}
for(int j=0;j<nb;j++){
String toto = table.getValue(i);
//do other actions
//here verify that list1 doesn't contain toto
//I tried :
assetFalse(table.getValue(i).contains(list1)); //not OK !
}
閱讀:http://stackoverflow.com/questions/23445/how-best-to-compare-two-collections-in-java-and-act-on-them –
你問什麼問題?什麼不行? –
我想在第二個循環中創建一個列表,然後驗證list1的內容在列表2中不可用 – lola