contains method in java for arraylist code example Example: java arraylist contains string boolean ans = arr.contains("geeks");