code: public void clear() {
          modCount++;
  
          // clear to let GC do its work
          for (int i = 0; i < size; i++)
              elementData[i] = null;
  
          size = 0;
      }
docs: Removes all of the elements from this list.  The list will
  be empty after this call returns.