How to replace element if exists in an ArrayList at a given index?
Just add a break after your remove() statement