add method

void add(
  1. E element
)

Adds the specified element to the end of this bag. If needed also increases the capacity of the bag.

Implementation

void add(E element) {
  // is size greater than capacity increase capacity
  if (_size == _data.length) {
    _grow();
  }
  _data[_size++] = element;
}