I am trying to see if an element in my array is contained in one of my other arrays. I don't want to use a nested for loop for this and I am curious as to why my .contains
does not work.
Currently I have two arrays
double [] s2 = new double [4];
double [] match = new double [s2.length];
and I am trying to test if s2
contains any of the values in my match
array
for (j = 0; j < s2.length; j++)
{
if(Arrays.asList(s2).contains(match[j])){
return true;
}
}
Does this have something to do with the double datatype I am using? If so is there a way I can still use .contains
?