Esempio n. 1
0
 public Object pop() throws StackEmptyException {
   Object objeto = null;
   try {
     objeto = lista.removeFromFront();
     contador--;
   } catch (Exception e) {
     throw new StackEmptyException();
   }
   return objeto;
 }
Esempio n. 2
0
 public Object top() throws StackEmptyException {
   if (isEmpty()) throw new StackEmptyException();
   else return lista.getFirstNode().getObject();
 }
Esempio n. 3
0
 public void push(Object o) {
   lista.insertAtFront(o);
   contador++;
 }
Esempio n. 4
0
 public boolean isEmpty() {
   return lista.isEmpty();
 }