java集合中stack的实现
- 使用vector类(vector类是ArrayList的早期版本)
String[] data={"to","be","or","not","to","be"};
Stack<String> s=new Stack<String>();
stack类的实现
- 继承方式:扩展ArrayList类来定义栈
- 组合方式:数组线性表定义为栈中的数据域
String[] data={"to","be","or","not","to","be"};
Stack<String> s=new Stack<String>();