public void printList() {

      System.out.println(this);
      if (nextElement != null) {
        nextElement.printList();
      }
    }
  public void printList() {

    if (headOfStack != null) {
      headOfStack.printList();
    }
  }