wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes arrayList.remove() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "arrayList.remove()" Watch "arrayList.remove()" New topic
Author

arrayList.remove()

aude tantot
Ranch Hand

Joined: May 21, 2001
Posts: 39
i've an arrayList and i want to use the remove() method, but when i do it on the first or last element, it delete the second or the one before the last element, what's the matter?
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
Perhaps a code snippet showing how you're indexing the ArrayList might shed some light on the problem.
Sean
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Remeber that arraylist, arrays, start indexing at zero in Java. Verify that's not the problem.

Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
aude tantot
Ranch Hand

Joined: May 21, 2001
Posts: 39
the problem comes in fact from the way i pass the element to be deleted. I select it from a combobox doing MyCombo.getSelectedItem(), and it returns me a wrong element.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: arrayList.remove()