This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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()
 
Similar Threads
Multiplying elements of two arrays together
html table to excel problem
Array question
Remove last element of string
Doubly Linked List