code: public int set(int i, int newValue) {
          while (true) {
              try {
                  updateLock.lock();
                  try {
                      return store.get().set(i, newValue);
                  } finally {
                      updateLock.unlock();
                  }
              } catch (PaletteFullException pfe) {
                  resizeLock.lock();
                  try {
                      try {
                          return store.get().set(i, newValue);
                      } catch (PaletteFullException pfe2) {
                          if (store.get().isPaletteMaxSize()) {
                              store.set(new AtomicShortIntDirectBackingArray(store.get()));
                          } else {
                              store.set(new AtomicShortIntPaletteBackingArray(store.get(), true));
                          }
                      }
                  } finally {
                      resizeLock.unlock();
                  }
              }
          }
      }
docs: Sets an element to the given value
  
  @param i the index
  @param newValue the new value
  @return the old value