xmerge: Avoid java.util.ConcurrentModificationException

Fix removeByName function, which deletes elements of the list without an iterator.

Move declarations inside the for loop in the removeByJar function, and delete the comment about removing list elements.

Change-Id: I6a9ba82af2999703d1447c5c0bc5800ec4367b65