import java.util.LinkedList; /** * java栈数据结构的LinkedList实现 */ public class LinkedListAsStack { LinkedList stack = new LinkedList(); public void push(Object o1) { stack.add(o1); } public Object pop() { return stack.removeLast(); } public Object topEle() { return stack.getLast(); } public boolean isEmpty() { return stack.isEmpty(); } public void clean() { stack.clear(); } }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/10193.html