1: /** Adds a new entry to this bag.
2: @param newEntry The object to be added as a new entry.
3: @return True if the addition is successful, or false if not. */
4: public boolean add(T newEntry)
5: {
6: checkInitialization();
7: boolean result = true;
8: if (isArrayFull())
9: {
10: doubleCapacity();
11: } // end if
12:
13: bag[numberOfEntries] = newEntry;
14: numberOfEntries++;
15:
16: return true;
17: } // end add