How to replace element if exists in an ArrayList at a given index?
just use this method inside arraylist
list.set(/*index*/,/*value*/)