Source of 3.21.java


  1:         /** Removes one unspecified entry from this bag, if possible.
  2:        @return  Either the removed entry, if the removal was successful, or null
  3:     @author Frank M. Carrano, Timothy M. Henry
  4:     @version 5.0 */
  5:         public T remove()
  6:         {
  7:                 T result = null;
  8:       if (firstNode != null)
  9:       {
 10:          result = firstNode.data; 
 11:          firstNode = firstNode.next; // Remove first node from chain
 12:          numberOfEntries--;
 13:       } // end if

 15:                 return result;
 16:         } // end remove