java Vector的特点与使用
2020-12-13 06:13
标签:位置 city list void 基于 tor 数组 slf4j cto 基于数组,大小可变(数组扩容)。 我看了下源码,最大区别就是Vector的方法加了synchronized,是线程安全的 java Vector的特点与使用 标签:位置 city list void 基于 tor 数组 slf4j cto 原文地址:https://www.cnblogs.com/JuncaiF/p/11169518.htmlVector
Vector的数据结构
Vector与ArrayList的比较
常用方法使用例子
import java.util.Vector;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class VectorTest{
public static void main(String[] args) {
Vector
运行结果
2019-07-11 13:36:07,044 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - value : 10 ,index 0
2019-07-11 13:36:07,048 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - value : 20 ,index 1
2019-07-11 13:36:07,049 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - value : 1 ,index 2
2019-07-11 13:36:07,049 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - value : 30 ,index 3
2019-07-11 13:36:07,049 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - value : 3 ,index 4
2019-07-11 13:36:07,049 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - value : 4 ,index 5
2019-07-11 13:36:07,049 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - value : 5 ,index 6
2019-07-11 13:36:07,049 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - value: 10,index 0
2019-07-11 13:36:07,049 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - value: 10,index 0
2019-07-11 13:36:07,049 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - index 0 value is 10
2019-07-11 13:36:07,050 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - index 0 value is 10
2019-07-11 13:36:07,050 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - last index value is
2019-07-11 13:36:07,050 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - vector size is 7
2019-07-11 13:36:07,050 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - vector cap is 10
2019-07-11 13:36:07,050 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - vector to string [Ljava.lang.String;@17a7cec2
2019-07-11 13:36:07,051 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - vector size is 0
2019-07-11 13:36:07,051 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - vector cap is 10
2019-07-11 13:36:07,051 [main] INFO com.fang.java.javabase.firstcollection.VectorTest - vector is empty: true