I have created a new LinkedHashMap 'workingStrData' using 'strData' and I still get the error.
I am trying to remove some items from this LinkedHashMap based of another list.
The way strData is structured is
strData = [components[{key1:value1}{key2:value2}...]]
def workingStrData = new LinkedHashMap(strData)
List componentsToRemove = ['item1','item2'...]
int itemsRemoved = 0
workingStrData.components.eachWithIndex {
comp, workingStrIndex ->
println("Index: "+workingStrIndex+" Component: "+comp.number)
def baditem = comp.number in componentsToRemove
if (baditem) {
strData.components.remove(workingStrIndex - itemsRemoved)
itemsRemoved += 1
}
}