title: Fast way to compare arrays using two identifyer (rowIndex, colIndex)
body: <p>Hello I'm working on a 2d map loader that uses chunks.</p>
  
  <p>I'm using this method to calculate the positions of the chunk that are intersecting with the screen bounds.</p>
  
  <pre><code>// left bottom
  rect.x = x - x % chunkSize;
  if (x &lt; 0) rect.x -= chunkSize
  rect.colIndex = (int) (rect.x / chunkSize);
  
  rect.y = y - y % chunkSize;
  if (y &lt; 0) rect.y -= chunkSize;
  rect.rowIndex = (int) (rect.y / chunkSize);
  
  // right top
  float x2 = x + width, y2 = y + height;
  
  float rectX = x2 - x2 % chunkSize;
  if (x2 &lt; 0) rectX -= chunkSize;
  int colIndex = (int) (rectX / chunkSize);
  
  float rectY = y2 - y2 % chunkSize;
  if (y2 &lt; 0) rectY -= chunkSize;
  int rowIndex = (int) (rectY / chunkSize);
  
  rect.rows = rowIndex - rect.rowIndex + 1;
  rect.cols = colIndex - rect.colIndex + 1;
  
  for (int i = 0; i &lt; rect.rows; i++) {
      for (int j = 0; j &lt; rect.cols; j++) {
          Chunk chunk = chunkPool.obtain();
          chunk.x = rect.x + chunkSize * j;
          chunk.y = rect.y + chunkSize * i;
          chunk.rowIndex = rect.rowIndex + i;
          chunk.colIndex = rect.colIndex + j;
      }
  }
  </code></pre>
  
  <p><strong>Info:</strong> </p>
  
  <ul>
  <li><p>If an Chunk is added it has to load data, if its removed the chunk data hast to be unloaded.</p></li>
  <li><p>This method gets called each time when the screen <code>x / y / size</code> does change.</p></li>
  </ul>
  
  <p><strong>My question is:</strong> I need to know what Chunks is removed / added from the last array. How can I do that. For identifying I would use the <code>rowIndex / colIndex</code>. It should be fast because it will be called frequently. Could a HashTable be an option?</p>