title: How to get the difference of two maps based on the key set?
body: <p>I have two maps:</p>
  
  <pre><code>Map&lt;String, Sample&gt; newMap = convertJSONObjectToSampleMap(newMapStr);
  Map&lt;String, Sample&gt; oldMap = convertJSONObjectToSampleMap(oldMapStr);
  </code></pre>
  
  <p><em>the <code>Sample</code> is some custom class</em></p>
  
  <p>The  <code>newMap</code> has keys: <code>[1,2,3,4,5]</code>
  The  <code>oldMap</code> has keys: <code>[2,3,4,5,8]</code></p>
  
  <p><strong>What is the best way to get difference between them, .e, get <code>Sample</code>s with keys: <code>1</code> and <code>8</code>?</strong></p>
  
  <p>I thought to use <code>Collections</code> and extract <code>Set&lt;&gt;</code>:</p>
  
  <pre><code>Set&lt;String&gt; newSet = newMap.keySet();
  Set&lt;String&gt; oldSet = oldMap.keySet();
  </code></pre>
  
  <p>Thank you, </p>