Sparse Array Management Utilities

com.srbenoit.sparsearray

This package provides classes to manage sparse arrays in which objects that are added retain their array position over their entire lifetime within the array (allowing them to be referenced by index), but the array can become sparse as objects are removed. The arrays track the lowest open position in the array and fill that position first when new elements are added. These arrays are intended to support efficient management of large numbers of objects (like points and vectors, for example), without doing non-essential copying or moving of data.

SparseArray
An array of objects that supports addition and deletion of objects, but will not change the index of a object once added. That is, deleting objects makes the array sparse, and adding new objects may fill in gaps left by deleting objects before appending to the end of the array. Storage is allocated in blocks of fixed size as needed to add objects.
SparseArrayException
An exception thrown by sparse arrays when invalid operations are attempted.
SparseArrayIterator
An iterator that will iterate over a sparse array's elements.
SparseArrayListener
An interface for objects that need to be notified when the internal structure of a sparse array changes.

As the author of the source code available by following the links above, I hereby place this source code in the public domain. You can use, modify, and distribute the source code and executable programs based on the source code. However, note the following:
DISCLAIMER OF WARRANTY
This source code is provided "as is" and without any express or implied warranties whatsoever. The user must assume the entire risk of using the source code.