Search Results

Search found 1 results on 1 pages for 'user73710'.

Page 1/1 | 1 

  • How to remove items from an arraylist without shrinking the list [migrated]

    - by user73710
    I have a case where I am using the ArrayList to keep a list of items that are keyed by their position in the list. Other objects reference the ArrayList items by their position. If I delete one of the items from the list, I don't want the list to shrink because that would invalidate all other references to items in the list (e.g. item 2 is now in position 1). My solution to the shrinking array list problem is to null the position in the arraylist so that the list will not shrink. I am curious whether this will free the memory formerly held by the item at that position. If there is a better way to accomplish this requirement, I would like to know about it.

    Read the article

1