@startuml 'skinparam nodesep 70 skinparam defaultFontName Hiragino Sans GB title <b>Stack</b> interface Iterable<E> interface Collection<E> extends Iterable interface List<E> extends Collection abstract class AbstractCollection<E> implements Collection abstract class AbstractList<E> extends AbstractCollection implements List class Vector<E> extends AbstractList implements RandomAccess, Cloneable, java.io.Serializable class Stack<E> extends Vector @enduml
Stack
的实现极其简单。可以用几句话概括完:
-
Stack
直接继承至Vector
,在其基础之上,只是增加了栈相关的操作; -
在方法上使用
synchronized
来实现线程安全;