title: Comparing two NSDictionaries and deleting if keys don't match
body: <p>In my app I'm using two NSMutableDictionaries. Lets call them basicDictionary and refreshDictionary.</p>
  
  <p>In basicDictionary I have values, lets say</p>
  
  <p>key:"1" value:"2000" photo:someUIImage //Lets say I want to track score of player
  key:"2" value:"1500" photo:someUIImage2
  key:"3" value:"1500" photo:someUIImage3
  key:"4" value:"1500" photo:someUIImage4</p>
  
  <p>key stands for player id and rest is pretty clear.</p>
  
  <p>I do server api call every 20 sec to refresh score of players. Because I don't want to load photo as well im using refresh call to bring me only player id and his actual score.</p>
  
  <p>So every 20 secs I get data that I save in refreshDictionary. There are only ids and current score of that id.</p>
  
  <p>refreshDictionary example:</p>
  
  <p>key:"1" value:"2500"
  key:"2" value:"2800"
  key:"3" value:"2700"</p>
  
  <p>I update my tableView with new values. As you can see, I got data only for 3 players, because player 4 has deleted his profile. Now my question is, how do I update basicDictionary to remove player 4?</p>
  
  <p>I know that I'm supposed tu use <code>if (!([basicDictionary isEqualToDictionary:refreshDictionary))</code>
  however, it won't tell me at which key they aren't equal.</p>
  
  <p>So what would you guys do? Should I iterate through both of them in nested loop? That seems to consume alot of time when dictionaries are bigger. Oh by the way, my dictionaries are always sorted same way (by players id)</p>
  
  <p>My idea is, that I compare these two dictionaries in </p>
  
  <pre><code>    - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
          if (refresh)
          { //compare dictionaries and modify basicDictionary that is data source for my tableview by deleting where key doesn't match
  }
  </code></pre>