I am trying to find duplicate numbers in arraylist. Arraylist contains {1.A, 2.B, 3.C, 3.D, 4.A...}I want to print duplicate values like 3.C 3.D.Can you help me please how can I print duplicate values in 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++;
}
}