Topic awaiting preservation: Anyone a Java guru here? (Page 1 of 1) |
|
---|---|
Maniac (V) Inmate From: Charles River |
posted 11-08-2003 01:18
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 |
posted 11-08-2003 01:57
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 |
posted 11-08-2003 02:18
Worked fine. |