Skip to content

Latest commit

 

History

History
32 lines (19 loc) · 735 Bytes

java.util.Stack.adoc

File metadata and controls

32 lines (19 loc) · 735 Bytes

Stack

@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 的实现极其简单。可以用几句话概括完:

  1. Stack 直接继承至 Vector,在其基础之上,只是增加了栈相关的操作;

  2. 在方法上使用 synchronized 来实现线程安全;