How to show a removed item or Array?
Hi there
I am really inexperienced in java programming.. well I need to figure out how to show something that has been removed from an ArrayList.size...
i.e
public void removeMe(int iIndex)
{
ArrayList.remove(iIndex);
}
I just need to kno how can I show the removed item? cheerz.. any help would be highly appriciated
[366 byte] By [
sifatka] at [2007-10-3 6:17:53]

Thanks for your reply..
well mate I am doing this assignment for a car dealer...so basically i have to show the list of cars which are sold..
i can add the cars by using
ArrayList.add(Car newCar)
and when I run the sell method on my Dealership class
it would remove the car from the ArrayList.size
so in the "sell" method I have something like this
ArrayList.remove(soldCar)
so my question is how can I show the car which have been recently removed from the ArrayList on a different method...
something like listSoldCars()...
cheerz
At the time it is used, the remove method returns a reference to the object removed. So, you need to capture the value of this reference in a variable. If you then wish to later be able to list all of the removed items, you must then save these references in an additional list and then you can list the items in this new list, in order to see which items were removed from the original list. But ArrayList (and all other collections) do not retain a reference list of removed items. If they did, then essentially the item would not have been removed at all, since there is still an existing reference to it in the Collection (even if it were not in the active list).