Java Array, Finding Duplicates

前端 未结 14 915
闹比i
闹比i 2020-11-22 09:13

I have an array, and am looking for duplicates.

duplicates = false;
for(j = 0; j < zipcodeList.length; j++){
    for(k = 0; k < zipcodeList.length; k++         


        
14条回答
  •  灰色年华
    2020-11-22 09:57

    Cause you are comparing the first element of the array against itself so It finds that there are duplicates even where there aren't.

提交回复
热议问题