Source of 2.40.java


  1:    /** Adds a new entry to this bag.
  2:        @param newEntry  The object to be added as a new entry.
  3:        @return  True.
  4:        @author Frank M. Carrano, Timothy M. Henry
  5:        @version 5.0
  6:    */
  7:    public boolean add(T newEntry)
  8:    {
  9:       checkIntegrity();
 10:       boolean result = true;
 11:       if (isArrayFull())
 12:       {
 13:          doubleCapacity();
 14:       } // end if

 16:       bag[numberOfEntries] = newEntry;
 17:       numberOfEntries++;

 19:       return true;
 20:    } // end add