if i in list in java code example
Example 1: list contains
List<Integer> arr = new ArrayList<Integer>(4);
boolean ans = arr.contains(2);
Example 2: java arraylist contains string
boolean ans = arr.contains("geeks");
List<Integer> arr = new ArrayList<Integer>(4);
boolean ans = arr.contains(2);
boolean ans = arr.contains("geeks");