docs: @Override
      public E set(int index, E element) {
          final ReentrantLock lock = this.lock;
          lock.lock();
          try {
              Object[] elements = getArray();
              E oldValue = get(elements, index);
  
              if (oldValue != element) {
                  int len = elements.length;
                  Object[] newElements = Arrays.copyOf(elements, len);
                  newElements[index] = element;
                  setArray(newElements);
              } else {
                  // Not quite a no-op; ensures volatile write semantics
                  setArray(elements);
              }
              return oldValue;
          } finally {
              lock.unlock();
          }
      }