ListStack.java

//My linked list Queue implementation

class ListStack {
    ListNode list;

    public void push(Object o) {
	ListNode node = new ListNode();
	node.value = o;
	node.next  = list;
	list=node;
    }

    public Object pop() {
	if (list==null) { 
	    System.out.println("Remove: can't remove because stack is empty.");
	    return null; 
	}
	Object o = list.value;
	list = list.next;
	return o;
    }

    public boolean notEmpty() {
	return list != null;
    }
}

Generated by GNU enscript 1.6.3.