private void Remove(int idx_remove, T val_remove) { int idx_update = vals.Count - 1; var val_update = idx2val[idx_update]; // Remove value vals.RemoveUnordered(idx_remove); // Update moved value in the lookup dictionaries val2idx[val_update] = idx_remove; idx2val[idx_remove] = val_update; // Remove outdated value from the lookup dictionaries val2idx.Remove(val_remove); idx2val.Remove(idx_update); }
private void Remove(int idx_remove, TKey key_remove) { int idx_update = keys.Count - 1; var key_update = idx2key[idx_update]; // Remove key and value keys.RemoveUnordered(idx_remove); vals.RemoveUnordered(idx_remove); // Update moved key and value in the lookup dictionaries key2idx[key_update] = idx_remove; idx2key[idx_remove] = key_update; // Remove outdated key and value from the lookup dictionaries key2idx.Remove(key_remove); idx2key.Remove(idx_update); }