F****n 发帖数: 3271 | 1 List is a general interface implemented by LinkedList, ArrayList, and Vector.
LinkedList is fast to insert and delete, while ArrayList is fast to access
through index. Evaluate your the major future burden on your List before
choose between the two. Vector is not java1.1 stuff, and it implements List
for back compatibility reason. Java2 programming should avoid Vector as much
as possible. If you want a synchronized List, use
Collections.sychronizedList(List) to pack one. | F****n 发帖数: 3271 | 2 You can get sychcronized Lists using the methods I mentioned above. The
problem of Vector is that you can not get a unsynchronized one:). There are
two reason to use unsynchornized data structure: first, it is much faster,
second, sometimes unnecessary sychronization will cause deadlock problems, for
example, in bean-based application.
than
access | a****o 发帖数: 37 | 3 use immutable list bah. much easier to do concurrent programming.
check out the following link:
http://gee.oswego.edu/~dl/index.html
there're a pretty cool immutable collection framework and a concurrent
library.
Sometimes a ML style immutable list would be neat and enough.
all |
|