Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/classes/java/util/Stack.java
          +++ new/src/share/classes/java/util/Stack.java
↓ open down ↓ 65 lines elided ↑ open up ↑
  66   66      public E push(E item) {
  67   67          addElement(item);
  68   68  
  69   69          return item;
  70   70      }
  71   71  
  72   72      /**
  73   73       * Removes the object at the top of this stack and returns that
  74   74       * object as the value of this function.
  75   75       *
  76      -     * @return     The object at the top of this stack (the last item
  77      -     *             of the <tt>Vector</tt> object).
  78      -     * @exception  EmptyStackException  if this stack is empty.
       76 +     * @return  The object at the top of this stack (the last item
       77 +     *          of the <tt>Vector</tt> object).
       78 +     * @throws  EmptyStackException  if this stack is empty.
  79   79       */
  80   80      public synchronized E pop() {
  81   81          E       obj;
  82   82          int     len = size();
  83   83  
  84   84          obj = peek();
  85   85          removeElementAt(len - 1);
  86   86  
  87   87          return obj;
  88   88      }
  89   89  
  90   90      /**
  91   91       * Looks at the object at the top of this stack without removing it
  92   92       * from the stack.
  93   93       *
  94      -     * @return     the object at the top of this stack (the last item
  95      -     *             of the <tt>Vector</tt> object).
  96      -     * @exception  EmptyStackException  if this stack is empty.
       94 +     * @return  the object at the top of this stack (the last item
       95 +     *          of the <tt>Vector</tt> object).
       96 +     * @throws  EmptyStackException  if this stack is empty.
  97   97       */
  98   98      public synchronized E peek() {
  99   99          int     len = size();
 100  100  
 101  101          if (len == 0)
 102  102              throw new EmptyStackException();
 103  103          return elementAt(len - 1);
 104  104      }
 105  105  
 106  106      /**
↓ open down ↓ 35 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX