Let's assume I have a class named People that contains hundreds of instances. One attribute of People is email_address. Another attribute is name.
How do I search though all People to find the attribute 'email_address' that has a value of 'spam_me@email.com' and have the People.name of that instance returned so I can do whatever with that specific instance?
In my specific use case, the class is actually for similar industrial machines, and one machine out of many is the 'lead' and the others are the 'slaves'. I won't always know which is the lead, because they all have the ability to be lead. Which machine is lead rotates so that all machines have similar wear and hours on them. The slaves only turn on to do their thing when lead is not able to keep up with demand.
I like SQL, so this specific question, in SQL, would look something like so:
SELECT name FROM People WHERE email_address='spam_me@email.com';
Along the same train of thought, I don't necessarily always need the Person.name returned to me. At times, it would be just as well to replace spam_me@email.com with no@domain.tld
Again, in SQL, it would look something like so:
UPDATE People SET email_address=REPLACE(email_address,'spam_me@email.com','no@domain.tld');