private void moveEntryToIndex(int src, int dest) {
    if (src == dest) {
      return;
    }
    int predecessor = prevInInsertionOrder[src];
    int successor = nextInInsertionOrder[src];
    setSucceeds(predecessor, dest);
    setSucceeds(dest, successor);

    K key = keys[src];
    V value = values[src];

    keys[dest] = key;
    values[dest] = value;

    // update pointers in hashTableKToV
    int keyHash = Hashing.smearedHash(key);
    int keyBucket = bucket(keyHash);
    if (hashTableKToV[keyBucket] == src) {
      hashTableKToV[keyBucket] = dest;
    } else {
      int prevInBucket = hashTableKToV[keyBucket];
      for (int entryInBucket = nextInBucketKToV[prevInBucket];
          /* should never reach end */ ;
          entryInBucket = nextInBucketKToV[entryInBucket]) {
        if (entryInBucket == src) {
          nextInBucketKToV[prevInBucket] = dest;
          break;
        }
        prevInBucket = entryInBucket;
      }
    }
    nextInBucketKToV[dest] = nextInBucketKToV[src];
    nextInBucketKToV[src] = ABSENT;

    // update pointers in hashTableVToK
    int valueHash = Hashing.smearedHash(value);
    int valueBucket = bucket(valueHash);
    if (hashTableVToK[valueBucket] == src) {
      hashTableVToK[valueBucket] = dest;
    } else {
      int prevInBucket = hashTableVToK[valueBucket];
      for (int entryInBucket = nextInBucketVToK[prevInBucket];
          /* should never reach end*/ ;
          entryInBucket = nextInBucketVToK[entryInBucket]) {
        if (entryInBucket == src) {
          nextInBucketVToK[prevInBucket] = dest;
          break;
        }
        prevInBucket = entryInBucket;
      }
    }
    nextInBucketVToK[dest] = nextInBucketVToK[src];
    nextInBucketVToK[src] = ABSENT;
  }
private void moveEntryToIndex(int src, int dest) {
    if (src == dest) {
      return;
    }
    int predecessor = prevInInsertionOrder[src];
    int successor = nextInInsertionOrder[src];
    setSucceeds(predecessor, dest);
    setSucceeds(dest, successor);

    K key = keys[src];
    V value = values[src];

    keys[dest] = key;
    values[dest] = value;

    
    int keyHash = Hashing.smearedHash(key);
    int keyBucket = bucket(keyHash);
    if (hashTableKToV[keyBucket] == src) {
      hashTableKToV[keyBucket] = dest;
    } else {
      int prevInBucket = hashTableKToV[keyBucket];
      for (int entryInBucket = nextInBucketKToV[prevInBucket];
           ;
          entryInBucket = nextInBucketKToV[entryInBucket]) {
        if (entryInBucket == src) {
          nextInBucketKToV[prevInBucket] = dest;
          break;
        }
        prevInBucket = entryInBucket;
      }
    }
    nextInBucketKToV[dest] = nextInBucketKToV[src];
    nextInBucketKToV[src] = ABSENT;

    
    int valueHash = Hashing.smearedHash(value);
    int valueBucket = bucket(valueHash);
    if (hashTableVToK[valueBucket] == src) {
      hashTableVToK[valueBucket] = dest;
    } else {
      int prevInBucket = hashTableVToK[valueBucket];
      for (int entryInBucket = nextInBucketVToK[prevInBucket];
           ;
          entryInBucket = nextInBucketVToK[entryInBucket]) {
        if (entryInBucket == src) {
          nextInBucketVToK[prevInBucket] = dest;
          break;
        }
        prevInBucket = entryInBucket;
      }
    }
    nextInBucketVToK[dest] = nextInBucketVToK[src];
    nextInBucketVToK[src] = ABSENT;
  }
private void moveEntryToIndex ( int src , int dest ) { if ( src == dest ) { return ; } int predecessor = prevInInsertionOrder [ src ] ; int successor = nextInInsertionOrder [ src ] ; setSucceeds ( predecessor , dest ) ; setSucceeds ( dest , successor ) ; K key = keys [ src ] ; V value = values [ src ] ; keys [ dest ] = key ; values [ dest ] = value ; // update pointers in hashTableKToV int keyHash = Hashing . smearedHash ( key ) ; int keyBucket = bucket ( keyHash ) ; if ( hashTableKToV [ keyBucket ] == src ) { hashTableKToV [ keyBucket ] = dest ; } else { int prevInBucket = hashTableKToV [ keyBucket ] ; for ( int entryInBucket = nextInBucketKToV [ prevInBucket ] ; /* should never reach end */ ; entryInBucket = nextInBucketKToV [ entryInBucket ] ) { if ( entryInBucket == src ) { nextInBucketKToV [ prevInBucket ] = dest ; break ; } prevInBucket = entryInBucket ; } } nextInBucketKToV [ dest ] = nextInBucketKToV [ src ] ; nextInBucketKToV [ src ] = ABSENT ; // update pointers in hashTableVToK int valueHash = Hashing . smearedHash ( value ) ; int valueBucket = bucket ( valueHash ) ; if ( hashTableVToK [ valueBucket ] == src ) { hashTableVToK [ valueBucket ] = dest ; } else { int prevInBucket = hashTableVToK [ valueBucket ] ; for ( int entryInBucket = nextInBucketVToK [ prevInBucket ] ; /* should never reach end*/ ; entryInBucket = nextInBucketVToK [ entryInBucket ] ) { if ( entryInBucket == src ) { nextInBucketVToK [ prevInBucket ] = dest ; break ; } prevInBucket = entryInBucket ; } } nextInBucketVToK [ dest ] = nextInBucketVToK [ src ] ; nextInBucketVToK [ src ] = ABSENT ; }
Moves the entry previously positioned at {@code src} to {@code dest}. Assumes the entry
previously at {@code src} has already been removed from the data structures.
Moves the entry previously positioned at {