import java.util.*; // // First In First Out // Stack // // public class FIFO{ Vector list; int length=0; FIFO(){ list=new Vector(); } // Put on stack -- add below on the stack .. the first on the stack goes first off the stack public void push(String S){ list.addElement((String)S); length=list.size(); } // Get the first available member and remove it public String pop(){ String retval=null; if(!list.isEmpty()){ retval=(String)list.firstElement(); list.removeElementAt(0); } length=list.size(); return retval; } //Investigate the first available member without removing it! public String next(){ String retval=null; if(!list.isEmpty()){ retval=(String)list.firstElement(); } return retval; } public boolean isEmpty(){ return list.isEmpty(); } public void clear(){ while(!list.isEmpty()){ list.removeElementAt(0); } } }