On Jan 10, 2007, at 2:53 PM, William Squires wrote:
On Jan 10, 2007, at 7:10 AM, Tom Benson wrote:
I just need a single dimensional array that stays in sequential
index order whenever I remove an element.
I know I could rebuild an array once I remove an entry, but the
arrays I'm dealing with could get rather large (10,000 + elements).
If there is a better framework solution for this, then someone
tell me, because I can't find one.....
- Tom
You'd have to write a wrapper class, and handle the 'Remove's
yourself. Or just remove the last element of the array. i.e. if -
in your example - you remove element three, then rearrange the
contents so that elements 3 and 4 contain 'three' and 'four' again,
then you get the same thing as if you had just removed the element
at the end (namely, 5, in your case) which seems like a lot simpler
solution (IIRC, the Pop method of an array will do this for you.)
Besides the fact that there already is a built-in method that does
exactly what he wants, to do a similar method in a multi-dimensional
array, one would start at the group of elements to be removed and
replace all elements with those with an index just above it. One
would then repeat this for each subsequent group of elements until
the Ubound of the array is reached. Actually, this is what
array.remove(x) does but it only does it for a one-dimensional array.
I believe there is a feature request to allow this in multi-
dimensional arrays.
Terry
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>