Collection:集合接口,List, ArrayList,LinedList,Vector均是其子类实现
以下为Java10文档的描述
Module java.base
Package java.util
Interface Collection
Type Parameters:
E - the type of elements in this collection
All Superinterfaces:
Iterable
All Known Subinterfaces:
BeanContext, BeanContextServices, BlockingDeque
All Known Implementing Classes:
AbstractCollection, AbstractList, AbstractQueue, AbstractSequentialList, AbstractSet, ArrayBlockingQueue, ArrayDeque, ArrayList, AttributeList, BeanContextServicesSupport, BeanContextSupport, ConcurrentHashMap.KeySetView, ConcurrentLinkedDeque, ConcurrentLinkedQueue, ConcurrentSkipListSet, CopyOnWriteArrayList, CopyOnWriteArraySet, DelayQueue, EnumSet, FilteredList, HashSet, JobStateReasons, LinkedBlockingDeque, LinkedBlockingQueue, LinkedHashSet, LinkedList, LinkedTransferQueue, ListBinding, ListExpression, ListProperty, ListPropertyBase, ModifiableObservableListBase, ObservableListBase, PriorityBlockingQueue, PriorityQueue, ReadOnlyListProperty, ReadOnlyListPropertyBase, ReadOnlyListWrapper, ReadOnlySetProperty, ReadOnlySetPropertyBase, ReadOnlySetWrapper, RoleList, RoleUnresolvedList, SetBinding, SetExpression, SetProperty, SetPropertyBase, SimpleListProperty, SimpleSetProperty, SortedList, Stack, SynchronousQueue, TransformationList, TreeSet, Vector
public interface Collection
extends Iterable
List:集合接口,是collection的子接口, ArrayList,LinedList,Vector是其实现的类,
Module java.base
Package java.util
Interface List
Type Parameters:
E - the type of elements in this list
All Superinterfaces:
Collection
All Known Subinterfaces:
ObservableList
All Known Implementing Classes:
AbstractList, AbstractSequentialList, ArrayList, AttributeList, CopyOnWriteArrayList, FilteredList, LinkedList, ListBinding, ListExpression, ListProperty, ListPropertyBase, ModifiableObservableListBase, ObservableListBase, ReadOnlyListProperty, ReadOnlyListPropertyBase, ReadOnlyListWrapper, RoleList, RoleUnresolvedList, SimpleListProperty, SortedList, Stack, TransformationList, Vector
public interface List
extends Collection
ArrayList:数组集合类,其实现由数组完成,初始化无参实例,默认长度为10,当增加元素超过长度时以2倍长度来增加,10,20,40,80....线程不安全。
Module java.base
Package java.util
Class ArrayList
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
Type Parameters:
E - the type of elements in this list
All Implemented Interfaces:
Serializable, Cloneable, Iterable
Direct Known Subclasses:
AttributeList, RoleList, RoleUnresolvedList
public class ArrayList
extends AbstractList
implements List
LinkedList:链表集合类,由链表实现,初始化无参实例时没有大小,
Module java.base
Package java.util
Class LinkedList
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.AbstractSequentialList
java.util.LinkedList
Type Parameters:
E - the type of elements held in this collection
All Implemented Interfaces:
Serializable, Cloneable, Iterable
public class LinkedList
extends AbstractSequentialList
implements List
Vector:数组集合类,和ArrayList类似,但是其相关方法实现由synchronized修饰,所以是线程安全的,效率相对低
评论区