00001 package com.graphbuilder.struc; 00002 00003 public class Stack extends LinkedList { 00004 00005 public Stack() {} 00006 00007 public Object peek() { 00008 if (head == null) 00009 return null; 00010 00011 return head.userObject; 00012 } 00013 00014 public Object pop() { 00015 return removeHead(); 00016 } 00017 00018 public void push(Object o) { 00019 addToHead(o); 00020 } 00021 }