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