Source of 2.24.java


  1:         /** Removes one unspecified entry from this bag, if possible.
  2:        @return either the removed entry, if the removal
  3:                was successful, or null */
  4:         public T remove()
  5:         {
  6:                 checkInitialization();
  7:       T result = null;
  8:                 
  9:                 if (numberOfEntries > 0))
 10:                 {
 11:          result = bag[numberOfEntries - 1]; // Entry to remove
 12:          bag[numberOfEntries - 1] = null;   // Remove reference to last entry
 13:          numberOfEntries--;
 14:                 } // end if
 15:       
 16:       return result;
 17:         } // end remove