zoukankan      html  css  js  c++  java
  • 集合框架(五)

    一、继承关系

    AbstractList<-Vector<-Stack
    

    二、Vector

    下面这段话来自Java 8的说明文档:

    As of the Java 2 platform v1.2, this class was retrofitted to implement the List interface, making it a     member of the Java Collections Framework. Unlike the new collection implementations, Vector is synchronized.     If a thread-safe implementation is not needed, it is recommended to use ArrayList in place of Vector. 
    

    Vector中List的实现方式和ArrayList基本一样,不过Vector是同步的。

    三、Statck

    下面这段话来自Java 8的说明文档:

    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with five operations     that allow a vector to be treated as a stack. The usual push and pop operations are provided, as well as a method     to peek at the top item on the stack, a method to test for whether the stack is empty, and a method to search     the stack for an item and discover how far it is from the top.
    
        A more complete and consistent set of LIFO stack operations is provided by the Deque interface and its implementations,     which should be used in preference to this class. For example:
    
      Deque<Integer> stack = new ArrayDeque<Integer>();  
    

    Stack继承了Vector,并提供了一些自己的方法,实现了List的后进先出的队列。Deque接口和其实现者为"后进先出"队列提供了提供了 更多的操作

    四、总结

    Vector和Stack都可以看做是Java1.2前的遗留产物,而且都是同步的(线程暂时不是很懂),List的实现一般使用ArrayList(快速随机访问) 或LinkedList(快速插入或删除操作)。

    All rights reserved please indicate the source if reprint---吓尿了的大肥鼠
  • 相关阅读:
    andriod 支付宝类似界面图片加文字
    评分条RatingBar Android
    Android 进度条对话框ProgressDialog
    Android 日期对话框DatePickerDialog
    andriod GridLayout
    android:TableLayout表格布局详解
    ArcGIS 10 SP5中文版(ArcGIS10补丁5中文版)
    Engine中如何进行七参数投影转换?
    如何去除栅格影像的黑边?
    资管机构年中规模排名出炉:中信资管规模超万亿
  • 原文地址:https://www.cnblogs.com/realsoul/p/5706159.html
Copyright © 2011-2022 走看看