I have a data structure as follows: I have a list of objects with properties that i want to search for and then when i have found all the objects matching my search query, i want to update another property for all the found objects. Here is an example of the object’s properties:
Name: Sean Aston
City: Toronto
Eye Color: Blue
Warnings: 4
Name: Cole Anderson
City: New York City
Eye Color: Black
Warnings: 1
Name: Polly Smith
City: Toronto
Eye Color: Blue
Warnings: 3
My search woluld be select all those objects in the list whose properties eye color is blue and city is toronto. It should return me objects one and three. Then i should be able to update the warnings property of the first and third object to increment by 1.
How can i achieve this?
Thanks in advance.
To match your exact request would look like this:
But I suspect the criteria is entirely determined by the user, and so you don’t know what you’re looking for at compile time like this. In that case: