親愛的我所有我比較Android中的兩個列表,如果兩個值是相同的,它是返回true,但罰款,但我想知道有多少值是正確的列表字符串之間,如果它是不匹配如何實現這個幫助表示讚賞。以下是我的代碼。在android中比較兩個列表<String>值
List<String> list1 = new ArrayList<String>(i1.values());
///list 1 = [-ful; to be full of; play; playful; full of play]
List<String> acct_Rte_Cdes_A = Arrays.asList(result) ;
///acct_Rte_Cdes_A = [-ful; to be full of; play; playful; full of play]
if (list1.equals(acct_Rte_Cdes_A)) {
// do what you want to do if the string is there
//System.out.println("True");
} else {
System.out.println("False");
}
如果它們不相等,則循環遍歷它們自己比較項目1by1並保留一個簡單的整數作爲每次項目匹配時遞增的計數。 –
在同一個問題上掙扎,你有答案嗎?如果是這樣,請發佈正確的答案。我需要從這兩個列表中獲得共同的價值觀。我跟着一些帖子,但那不工作。 – Madhu