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

    java集合类型:List、Set、Map、Queue

    List、Set、Queue向上均继承与Collection,Collection向上继承顶级接口Iterator,Map自己为一个顶级接口

    集合的实现类均不直接实现上面这些接口, 中间均有一个抽象类,如 List、Set、Queue下有一个AbstractCollection,往下又分成AbstractList与AbstractSet,Map下则有AbstractMap。

    List:

      ArrayList

      LinkedList

      Vector

      Stack

    Set:

      HashSet

      LinkedHashSet

      HashTable

      TreeSet

    Map:

      HashMap

      LinkedHashMap

      HashTable

      TreeSet

      WeakHashMap

      IdentityHashMap

    Set HashSet类型不允许重复经常遇到,无需重复。需要注意的是有序集合均有自己的有序接口,如SortedSet  、SortedMap, 注意NaviagableMap(继承于SortedMap),NaviagableSet(继承于SortedSet)用来获取离条件最近的元素

     Queue/Deque分为阻塞与非阻塞两种

    抽象类为AbstractQueue

    1、非阻塞:

      LinkedList

      PriorityQueue

      ConcurrentLinkedQueue

    2、阻塞  BlockingQueue

      ArrayBlockingQueue

      LinkedBlockQueue

      PriorityBlockingQueue

      SynchronousQueue

      DelayQueue

    使用场景较少的也最容易忘记的类

    WeakHashMap

       WeakHashMap的键是“弱键”。在 WeakHashMap 中,当某个键不再正常使用时,会被从WeakHashMap中被自动移除,垃圾回收器会自动回收

    IdentityHashMap

      比较对象时直接用==,而不是hash与equals,有其特殊用途,比如序列化或者深度复制。或者记录对象代理

  • 相关阅读:
    如何将Superset嵌入后台系统之实践
    如何将Superset嵌入后台系统之实践
    SQL server添加链接服务器脚本
    面试题:JQuery有几种选择器?
    数据库增加索引
    Mybatis与Ibatis比较
    jQuery 选择器
    Form 和 Input 对象
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
    xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!
  • 原文地址:https://www.cnblogs.com/shaozhen/p/11131966.html
Copyright © 2011-2022 走看看