code: private void replaceKeyInEntry(int entry, @NullableDecl K newKey, boolean force) {
      checkArgument(entry != ABSENT);
      int newKeyHash = Hashing.smearedHash(newKey);
      int newKeyIndex = findEntryByKey(newKey, newKeyHash);
  
      int newPredecessor = lastInInsertionOrder;
      int newSuccessor = ENDPOINT;
      if (newKeyIndex != ABSENT) {
        if (force) {
          newPredecessor = prevInInsertionOrder[newKeyIndex];
          newSuccessor = nextInInsertionOrder[newKeyIndex];
          removeEntryKeyHashKnown(newKeyIndex, newKeyHash);
          if (entry == size) { // this entry got moved to newKeyIndex
            entry = newKeyIndex;
          }
        } else {
          throw new IllegalArgumentException("Key already present in map: " + newKey);
        }
      }
      if (newPredecessor == entry) {
        newPredecessor = prevInInsertionOrder[entry];
      } else if (newPredecessor == size) {
        newPredecessor = newKeyIndex;
      }
  
      if (newSuccessor == entry) {
        newSuccessor = nextInInsertionOrder[entry];
      } else if (newSuccessor == size) {
        newSuccessor = newKeyIndex;
      }
  
      int oldPredecessor = prevInInsertionOrder[entry];
      int oldSuccessor = nextInInsertionOrder[entry];
      setSucceeds(oldPredecessor, oldSuccessor); // remove from insertion order linked list
  
      deleteFromTableKToV(entry, Hashing.smearedHash(keys[entry]));
      keys[entry] = newKey;
      insertIntoTableKToV(entry, Hashing.smearedHash(newKey));
  
      // insert into insertion order linked list, usually at the end
      setSucceeds(newPredecessor, entry);
      setSucceeds(entry, newSuccessor);
    }
docs: Updates the specified entry to point to the new value: removes the old value from the V-to-K
  mapping and puts the new one in. The entry is moved to the end of the insertion order, or to
  the position of the new key if it was previously present.