简体   繁体   English

向量和同步链表哪个更好用?

[英]Vector or Synchronized LinkedList?Which is better to use?

I think this is very interesting topic.我认为这是一个非常有趣的话题。 In your choice, then which is better between Vector or synchronized LinkedList?在您的选择中,Vector 和同步 LinkedList 哪个更好?

Synchronized for LinkedList:为 LinkedList 同步:

LinkedList linkedlist=new LinkedList();
List synchronizedlist= Collections.synchronizedList.(linkedlist);

The main difference is their implementation which causes different performance for different operations.主要区别在于它们的实现会导致不同操作的性能不同。

Vector is similar with ArrayList, but it is synchronized. Vector 与 ArrayList 类似,但它是同步的。

Syncronized LinkedList is implemented as a double linked list.同步 LinkedList 实现为双链表。 Its performance on add and remove is better than Arraylist, but worse on get and set methods.它在 add 和 remove 上的性能比 Arraylist 好,但在 get 和 set 方法上更差。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM