The issue originally not related to id's I just simplified https://
Test case war attached.
<h:commandButton value="Add" action="#
<h:commandButton value="Remove" action="#
Bean contains ArrayList of Strings. We removing String "2". And getting "1" and
"3" fine rendered. BUT: <ui:debug/> shows us that there are still three
outputText components in tree. And after we trying to add "2" back - duplicated
id exception risen.
If after removing but before adding we will refresh the page - this issue will
not appears. Also the problem not reproduced if we removing last imtem from
list instead of second.
We investigated the case and found out that seems when forEach handler invoked
on build view - component handler doesn't process last component because of the
collection new length.