---
title: "Java Vector和ArrayList的区别"
author: "dir_murong"
date: "2010-10-28T11:06:01Z"
tags: []
categories: ["编程语言"]
slug: "java-vector-arraylist"
draft: false
lastmod: "2010-10-28T17:57:17Z"
id: 796287
url: "https://dir-murong.iteye.com/blog/796287"
---

Collection
├List
│├LinkedList
│├ArrayList
│└Vector
│　└Stack
└Set
Vector和ArrayList都是集合,是java中实现可变数组的方法,<span style="color:red">都实现了List接口</span>.
唯一的区别是<span style="color:red">Vector是同步的</span>,而同步是需要时间的,所以效率上要低一些.
而<span style="color:red">ArrayList是异步的</span>,所以速度要<span style="color:red">比Vector快</span>,在<span style="color:red">需要同步的时候使用Collections.synchronizedList进行同步</span>.
因为ArrayList比Vector性能好,所以现在使用ArrayList来代替了Vector.