美文网首页
java集合类-1-概述

java集合类-1-概述

作者: 宠辱不惊的咸鱼 | 来源:发表于2019-09-30 09:13 被阅读0次
    • Collection
      • List
        • ArrayList
        • LinkedList
      • Set
        • HashSet:基于HashMap
        • LinkedHashSet
    • Map
      • HashMap
      • LinkedHashMap
        • 继承HashMap,Entry中新增before和after属性,在newNode过程中额外处理,使得Iterator有序遍历
      • Hashtable
        • 与HashMap类似,线程同步,性能低
      • TreeMap
        • Comparator或Comparable,红黑树排序
    • 同步
      • 同步集合类:Hashtable、Vector
      • 同步封装类:Collections.synchronizedMap()、Collections.synchronizedList()
      • 整个集合加单锁,为防止ConcurrentModificationException,在迭代时将集合锁定,性能低
    • ConcurrentModificationException
      • iterator.next时,对list做写操作,引起modCount和expectedModCount不相等,抛ConcurrentModificationException
      • iterator.remove是可以的,因其末尾有expectedModCount = modCount
    • System.arraycopy
      • C++和汇编的结合,提升数组复制效率

    相关文章

      网友评论

          本文标题:java集合类-1-概述

          本文链接:https://www.haomeiwen.com/subject/kkdcpctx.html