Bidirectional map

In computer science, a bidirectional map, or hash bag, is an associative data structure in which the ${\displaystyle (key,value)}$ pairs form a one-to-one correspondence. Thus the binary relation is functional in each direction: ${\displaystyle value}$ can also act as a key to ${\displaystyle key}$. A pair ${\displaystyle (a,b)}$ thus provides a unique coupling between ${\displaystyle a}$ and ${\displaystyle b}$ so that ${\displaystyle b}$ can be found when ${\displaystyle a}$ is used as a key and ${\displaystyle a}$ can be found when ${\displaystyle b}$ is used as a key.