Given the following information and code can someone please walk me through whattakes place, and show me the resulting values for each of the variables: Msize = 10 NumInList = 5 Curr is set to 3 (pos) For a list array After the remove method what will be the new values in the list, and what value will curr point to? Array element and position. Before After 7 5 2 8 9 0 0 0 0 0 I think the remove only executes once but not sure.
I'm not sure just how this works so if you could trace the code through so I could see what takes place it might help me understand.
Ronald, Use "& lt" (without the space) in place of < when you are writing HTML. The < is interpreted as the beginning of a tag and will not be displayed correctly. [This message has been edited by Bodie Minster (edited January 26, 2001).]
Ronald, What your code is doing is re-adjusting the listArray after you remove the object. E.g. Given your list looks like following:  -> a  -> b  -> c // curr index is here  -> d  -> e  -> null // numInList index is here
And supposing curr is pointed to . After you invoke remove(), your list shifts everything up to fill the  slot.  -> a  -> b  -> d  -> e  -> e // numInList index is here  -> null NOTE Here's a JAVA gotcha. Notice when you shifted everything up, you created an extra reference to the last object, since all you did was shift everything it and substract one from numInList index. Your list is still keeping a reference to the object "e" around, so it will never get GC if your list stays around for the life of your application. For example, if we move curr index to the last position () and execute remove(), your list will now look like this:  -> a  -> b  -> d  -> e // numInList index is here  -> e  -> null This is because curr is at position 3 and subtracting one from numInList (4-1) is also 3, so no shifting is required. You're already at the end of the list. You still have to subtract one from numInList to reflect the fact that you removed one element from your list. To fix this problem, I would suggest modifying your code like this:
[This message has been edited by Peter Tran (edited January 26, 2001).]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com