shishir guptaa

Greenhorn
+ Follow
since Dec 23, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by shishir guptaa

what i can see the problem is

list.remove(o);

You should always use iterator to modify the list, like as below

ListIterator itr = list.listIterator();

while(itr.hasNext()){
iitr.remove();
System.out.println(list.size());
}

This will work for you.

Winston Gutkowski wrote:
Do you realize that you replied to a thread that is 18 months old? I suspect Elvis (or rather Harsha) has left the building.

Winston



i actually missed the date...will post carefully in future.
11 years ago
Vector is synchronized and Arraylist is not. By, synchronized it means here is, any method that touches Vector's content, is sync (or read it as thread safte).
Practically, for normal execution where you expect program to run in a single threaded env, use ArrayList and when in doubt or to protect data at any cost,
use synchronizedList from Collections api. Below is the link.

http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Collections.html#synchronizedList(java.util.List)

11 years ago