code: @SuppressWarnings("unchecked")
    private void ensure(final int newSize) {
      if (newSize >= this.elements.length) {
        final T[] newArray = (T[]) new Object[Math.max(newSize, this.size * 2)];
        System.arraycopy(this.elements, 0, newArray, 0, this.size);
        this.elements = newArray;
      }
    }
docs: Ensures that this vector has the given size.  If not - the size is doubled and the old elements are copied.
  @param newSize the size to ensure