title: Java Micro Edition (J2ME) - Delete element from Record Store
body: <p>I have a record store which holds a list of shopping items i am currently serialising the data like so</p>
  
  <pre><code>** (inside) ItemClass **            
  ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
  DataOutputStream dataOutputStream = new DataOutputStream(byteOutputStream);
  
  dataOutputStream.writeUTF(getOwner());
  dataOutputStream.writeUTF(getItemName());
  dataOutputStream.writeInt(getQuantity());
  
  dataOutputStream.close();
  
  return byteOutputStream.toByteArray();
  </code></pre>
  
  <p>This byte array is then written to the record store like so (using for loop for each id)</p>
  
  <pre><code>for (int i = 1; i &lt;= shoppingListStore.getNumRecords(); i++)
  {
       byte[] itemRecord = shoppingListStore.getRecord(i);
       newItemObject.fromByteArray(itemRecord);
       userShoppingList.append(newItemObject.getItemName() + " " + newItemObject.getQuantity() + " " + newItemObject.getOwner(), null);
  }
  </code></pre>
  
  <p>The problem comes from using the ID to treverse through the record store as this may change from deletion etc and as such i keep geting invalid id being thrown. I know i cannot use For each ItemObj : Recordstore so how do i treverse through the record store without having to worry about ids ?</p>