我试图在arraylist中找到重复的数字。 Arraylist包含{1.A,2.B,3.C,3.D,4.A ...}我想要打印重复值,如3.C 3.D.Can你帮我请怎样才能打印复制品arraylist中的值?
while (scRef.hasNext()) {
word1 = scRef.next();
listRef.add(word1);
}
while (scStud.hasNext()) {
word2 = scStud.next();
listStud.add(word2);
}
for ( int i=0; i<listRef.size(); i++) {
for(int j = 0; j < listStud.size(); j++)
if (listRef.get(i).equals(listStud.get(j))) {
ccount++;
}
}