A C*_*A C 8 java stack arraylist
我有一个预定义了硬编码值的ArrayList.如何将这些添加到堆栈?这个想法是为了演示堆栈类的pop,push,peek函数.
ArrayList<String> al = new ArrayList<String>();
al.add("A");
al.add("B");
al.add("C");
Stack<String> st = new Stack<String>();
st.push(al); **// This doesn't seem to work.. Will I have to loop it in some way?**
System.out.println(st);
Run Code Online (Sandbox Code Playgroud)
谢谢!
| 归档时间: |
|
| 查看次数: |
12447 次 |
| 最近记录: |