Very interesting question :)
On SFSE, there is a wonderful answer about tracking changes between old and new through any field description or JSON serialization: Common fields of sObject fields . Please note that I am related to the answer that I find most neat, consider reading the entire page!
This question is also interesting because it would put your logic in a more correct place - in the trigger. Because you have to ask yourself if itโs normal to make an update that doesnโt really change anything on your search page - should it be possible on other pages as well?
If this is not what works for you here is another interesting trick.
( , ). , :
Set<User> users = new Set<User>();
User u1 = new User(Id = UserInfo.getUserId());
User u2 = new User(Id = UserInfo.getUserId(), LastName = 'Doe');
users.add(u1);
users.add(u2);
System.assert(users.contains(u2));
u2.FirstName = 'John';
System.assert(users.contains(u2), users);
, Map<Id, sObject> , //- . - .
():
- , .
- none/some/all "submit".
Set<sObject> ( addAll).- . , .
mySet.removeAll(originals); - .- .
, , - - # 4 ... , ( List.deepClone) - !
( - - , removeAll equals . , )