Java - 抽象容器類
抽象容器類與集合和具體容器類之間的對應關係如圖所示:
其中虛線表示接口,包含Collection,List,Set,Queue,Deque和Map。同時包含六個抽象容器類。
- AbstractCollection: 實現了Collection接口,被抽象類AbstractList、AbstractSet、AbstractQueue繼承,ArrayDeque也繼承自AbstractCollection。
- AbstractList: 父類是AbstractCollection,實現了List接口,被ArrayList、AbstractSequentialList繼承。
- AbstractSequentialList: 父類是AbstractList,被LinkedList繼承。
- AbstractMap: 實現了Map接口,被TreeMap、HashMap、EnumMap繼承。
- AbstractSet: 父類是AbstractCollection,實現了Set接口,被HashMap
- AbstractQueue: 父類是AbstractCollection,實現了Queue接口,被PriorityQueue繼承。