I'm curious if there is another way to code this. Could it be done with a while
loop for instance?
public static int numUnique(double[] list) {
int uniques = 0;
if(list.length == 0){return 0;}
for(int i = 0; i < list.length; i++){
int dups = 0;
for(int j = i + 1; j < list.length; j++){
if(list[i] == list[j]){
dups = dups + 1;
}
}
if(dups == 0){
uniques = uniques + 1;
}
}
return uniques;
}