File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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


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
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.
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.


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:
subject: arrayList.remove()
It's not a secret anymore!