Stack<Character> stackS = new Stack();
int a = stackS.size();
int java.util.Vector.size()
Returns the number of components in this vector.
Specified by: size() in List, Overrides: size() in AbstractCollection
Returns:
the number of components in this vector
常用的实现方法:
基于简单数组
基于动态数组
基于链表
应用:
符号匹配
计算后缀表达式
中缀表达式转换为后缀表达式
实现函数调用(包括递归)
求范围误差
网页浏览器中访问页面的历史记录(后退back键)
文本编辑中的undo序列
HTML和XML文件中的tag匹配
间接应用:
作为一个算法的辅助数据结构(eg.树遍历算法)
其他数据结构的组件(模拟队列)