simple code

List list = Collections.synchronised(new arrayList())...........what it does ?
[125 byte] By [intelchipa] at [2007-10-1 1:05:33]
# 1
Creates a synchronised (thread safe) ListRead the APIs, and tutorials http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#synchronizedList(java.util.List) http://java.sun.com/docs/books/tutorial/essential/threads/index.html
mlka at 2007-7-8 1:23:37 > top of Java-index,Security,Event Handling...
# 2
so this code intention was to create a thread safe List ...right ?..........But why this way ? already we have Vectors! . those are thread safe also!!N.B : if they were not thread safe what harm could happen ? deadlock ? or data inconsitency?
intelchipa at 2007-7-8 1:23:37 > top of Java-index,Security,Event Handling...
# 3

A vector is a growable array, the method above lets you use any List implementation (in this case LinkedList).

I'm guessing you are doing a CS degree, have you covered data structures yet?

Plus Vector is not liked. It has "issues" (i.e. it is buggy, but people have worked round the bugs in ways that make fixing the bugs hard).

> deadlock ? or data inconsitency?

data inconsitency.

mlka at 2007-7-8 1:23:37 > top of Java-index,Security,Event Handling...
# 4
ok.......happy.
intelchipa at 2007-7-8 1:23:37 > top of Java-index,Security,Event Handling...
# 5
http://en.wikipedia.org/wiki/Deadlock
mlka at 2007-7-8 1:23:37 > top of Java-index,Security,Event Handling...
# 6
http://java.sun.com/docs/books/tutorial/reallybigindex.html
pgeuensa at 2007-7-8 1:23:37 > top of Java-index,Security,Event Handling...