DEV Community

Discussion on: Data Structures: Bidirectional Map

Collapse
 
pretaporter profile image
Maksim

Sure, thanks for your point. Why do you think we should use intersection instead?
If we will use intersection, then will be possible situation like this:

xx.set('a', 'b');
xx.set('c', 'b');
xx.getKey('b'); // returns c
Enter fullscreen mode Exit fullscreen mode

It is not correct