public void push(int item) {
   StackNode node = new StackNode(item);
   if (top == null) {
     top = node;
     return;
   }
   node.next = top;
   top = node;
 }
Пример #2
0
 /** @param the element to push */
 public void push(E e) {
   StackNode<E> node = new StackNode(e);
   node.next = top;
   top = node;
 }