1duplicates = false;
2
3for(i = 0; i < zipcodeList.length; i++) {
4 for(j = i + 1; k < zipcodeList.length; j++) {
5 if(j != i && zipcodeList[j] == zipcodeList[i]) {
6 duplicates = true;
7 }
8 }
9}
1// Uses a set, which does not allow duplicates
2
3for (String name : names)
4{
5 if (set.add(name) == false)
6 {
7 // print name your duplicate element
8 }
9}
1 for (String name : names) {
2 if (set.add(name) == false) {
3 // your duplicate element
4 }
5}