I have an undetermined size for a dataset based on unique integer keys.
I would like to use an NSMutableArray
for fast lookup since all my keys are inte
As in Jason's answer, an NSMutableDictionary seems to be the best approach. It adds the overhead of converting the index values to and from NSNumbers, but this is a classic space/time trade off.
In my implementation I also included an NSIndexSet to make traversing the sparse array much simpler.
See https://github.com/LavaSlider/DSSparseArray