.contains java arrays code example
Example 1: java array contains
Arrays.asList(yourArray).contains(yourValue)
Example 2: array contains java
StringArrayExample1.java
package com.mkyong.core;
import java.util.Arrays;
import java.util.List;
public class StringArrayExample1 {
public static void main(String[] args) {
String[] alphabet = new String[]{"A", "B", "C"};
// Convert String Array to List
List<String> list = Arrays.asList(alphabet);
if(list.contains("A")){
System.out.println("Hello A");
}
}
}