java arraylist check if contains any elements code example Example: java arraylist contains string boolean ans = arr.contains("geeks");