Redian新闻
>
List, LinkedList and Vector
avatar
List, LinkedList and Vector# Java - 爪哇娇娃
j*1
1
【 以下文字转载自 Complain 讨论区 】
发信人: mitbbs (未名空间), 信区: Complain
标 题: Re: [投诉]TrustinJesus版主Dignity两天之内狂删我19篇主题帖
发信站: BBS 未名空间站 (Tue Jun 28 02:58:38 2011, 美东)
由于版内炸版,会引起误删。版主可恢复其误删的帖子
avatar
F*n
2
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.
avatar
F*n
3
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
avatar
a*o
4
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
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。