code: private void setSucceeds(int prev, int next) {
      if (prev == ENDPOINT) {
        firstInInsertionOrder = next;
      } else {
        nextInInsertionOrder[prev] = next;
      }
      if (next == ENDPOINT) {
        lastInInsertionOrder = prev;
      } else {
        prevInInsertionOrder[next] = prev;
      }
    }
docs: Updates the pointers of the insertion order linked list so that {@code next} follows {@code
  prev}. {@code ENDPOINT} represents either the first or last entry in the entire map (as
  appropriate).