I have an Arraylist of integers. My requirement is to determine if the arraylist HAS an element existing at the specified index.If YES, then a value should be set to that in
ArrayList.set(index, element) will add the specified element in the list at mentioned index. This will be replace operation so list size will remain unchanged. ArrayList.add(index, element) will add the specified element in the list at mentioned index. This is not replace operation so it will first right shift all elements from the mentioned index & finally will add the element at index position. Now size = size+1.