for (int i = 0; i
......
}
another thread : v.removeElementAt (3)
ask what the problem ?
------ Solution ---------------------------------------- ----
Vector thread itself is relatively safe , there would be no big problem.
But you here Object obj = v.elementAt (i); access to the part after the object obj may have been removed from the Vector .
------ Solution ---------------------------------------- ----
last may be less a figure, and get out of the incomplete data
------ Solution --------------------- -----------------------
1. obtained data may not be what you want
2. deleted may be incorrect , v may not have three objects
------ Solution ---------------------- ----------------------
Vector is a linear safe collection should not be a problem, right
没有评论:
发表评论