I have a List of JValues in scala with the following format:
[{ id: "foo" values: {...}}, {}]
I want to go through the list, and, if the id is equal to a certain value, replace the values. In Java, I have this code
newList = List()
for (item in list) {
if (item.id == id) {
newList.add(newValues)
}
else {
newList.add(item)
}
}
} }
How would I do this in Scala?