Skip to main content
3 of 3
added 200 characters in body

Do something like:

Arrays.asList(array).contains(x); 

since that return true if the String x is present in the array (now converted into a list...)

Example:

if(Arrays.asList(myArray).contains(x)){ // is present ... :) } 

since Java8 there is a way using streams to find that:

boolean found = Arrays.stream(myArray).anyMatch(x::equals); if(found){ // is present ... :) }