在java中vector代表什么意思?大大帮忙,一定给分
不是java没有指针么? 问题点数:20、回复次数:8Top
1 楼Patrick_DK(我有我的调调,就是这么屌)回复于 2002-01-16 11:18:11 得分 2
vector 向量,存放对象的可变数组Top
2 楼skyyoung(路人甲)回复于 2002-01-16 11:21:20 得分 2
java.util
Class Vector
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.Vector
All Implemented Interfaces:
Cloneable, Collection, List, RandomAccess, Serializable
Direct Known Subclasses:
Stack
--------------------------------------------------------------------------------
public class Vector
extends AbstractList
implements List, RandomAccess, Cloneable, Serializable
The Vector class implements a growable array of objects. Like an array, it contains components that can be accessed using an integer index. However, the size of a Vector can grow or shrink as needed to accommodate adding and removing items after the Vector has been created.
Each vector tries to optimize storage management by maintaining a capacity and a capacityIncrement. The capacity is always at least as large as the vector size; it is usually larger because as components are added to the vector, the vector's storage increases in chunks the size of capacityIncrement. An application can increase the capacity of a vector before inserting a large number of components; this reduces the amount of incremental reallocation.
As of the Java 2 platform v1.2, this class has been retrofitted to implement List, so that it becomes a part of Java's collection framework. Unlike the new collection implementations, Vector is synchronized.
The Iterators returned by Vector's iterator and listIterator methods are fail-fast: if the Vector is structurally modified at any time after the Iterator is created, in any way except through the Iterator's own remove or add methods, the Iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the Iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future. The Enumerations returned by Vector's elements method are not fail-fast.
Since:
JDK1.0
See Also:
Collection, List, ArrayList, LinkedList, Serialized Form
Top
3 楼zero_wgh(traffic_light)回复于 2002-01-16 11:25:58 得分 2
一数据结构,类似与数组,但其长度可变Top
4 楼bookbobby(书呆)回复于 2002-01-16 11:25:59 得分 4
表示矢量
可以用来代替数组
主要不同是vector的长度可以自动增长
而数组不行Top
5 楼liukuncn(爱,还记得么?)回复于 2002-01-16 11:47:10 得分 2
普通数组长度不可变,而vector长度可变,但它只能存储对象Top
6 楼wuhuafu()回复于 2002-01-16 14:24:02 得分 4
类似于集合。可作为动态数组使用。可以存储任何内容,同一个Vector可以存储Integer,String,以及任何类(包括Vector)。可以实现复杂的数据结构
为了存储一个简单类型,需要转为一个对象,eg:int->IntegerTop
7 楼wuhuafu()回复于 2002-01-16 14:25:43 得分 2
可以说java的应用是安全指针!Top
8 楼night_knight(黑夜骑士只抽红河)回复于 2002-01-16 15:39:15 得分 2
象hashmapTop




