ID

The Unique ID will just be a number starting at 0. Gaps will occur if items are removed from the data store. Any such gaps must be handled in such a way that iteration using something like a for loop would not encounter them. How this is done is up to the implementation.

One such way would be to fill gaps with ``blank'' DataItems which would also be in an internal list of unallocated items. When a new item is added to the data store rather than creating the DataItem at $max+1$ it would just pick the first one from the list of gaps.

This way a remove would generate a gap and an add would remove it:
Items: 0 1 2 3 4  
Start allocated allocated allocated allocated allocated  
Remove Item 2 allocated allocated unallocated allocated allocated  
Remove item 0 unallocated allocated unallocated allocated allocated  
Add new item allocated allocated unallocated allocated allocated  
Add new item allocated allocated allocated allocated allocated  

David Goodwin 2008-10-21