public boolean hasMoreElements() {
   return (!stack.empty() && stack.peek().hasMoreElements());
 }