title: SparseArray, check if key exists
body: <p>I was implementing a Bitmap cache using a <code>HashMap&lt;Integer, Bitmap&gt;</code> and received the following warning in Eclipse:</p>
  
  <blockquote>
    <p>Use new SparseArray(...) instead for better performance.</p>
  </blockquote>
  
  <p>I've never heard of that class before, but inspecting it it doesn't seem to have a <code>containsKey()</code> method which I was calling on retrieval of a Bitmap from the cache to check if it exists in the cache, and if it doesn't, then add it.</p>
  
  <p>Any ideas on the best way to check if the key already exists? </p>
  
  <p>I guess I could change the code to use this overload and check for null?</p>
  
  <pre><code>Bitmap bitmap = cache.get(key, null); 
  </code></pre>