示例#1
0
  /**
   * Pushes the object on the stack.
   *
   * @param object
   */
  public void push(T object) {
    StackNode<T> stackNode = new StackNode<T>(object);
    stackNode.setNext(startElement);

    startElement = stackNode;
    size++;
  }
示例#2
0
 void push(char value) {
   StackNode newNode = new StackNode(value, null);
   if (start == null) {
     start = newNode;
   } else {
     newNode.setNext(start);
   }
   start = newNode;
 }