![]() Topic awaiting preservation: Anyone a Java guru here? (Page 1 of 1) |
|
---|---|
Maniac (V) Inmate From: Charles River |
![]() Can anyone tell me what I am doing wrong in this sample (removing an element from a collection, during an iteration): code: import java.util.*;
|
Bipolar (III) Inmate From: the uterus |
![]() You need to decrement the 'current' member within the remove function. It's not a Java problem, it's just logistics. When you call v.remove() all the indices from the specified remove index are naturaly decremented by one, thus your reference index 'current' should do the same. |
Maniac (V) Inmate From: Charles River |
![]() Worked fine. |