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