tags:

views:

147

answers:

1

Hi,

Can you please tell me what I can use in C# as an equivalent to TreeBidiMap from Commons Collections in Java.

Thanks

A: 

BidiMap is an interface which defines map which allows mapping from key to value as well as from value to key (thus "bidirectional"). TreeBidiMap is the implementation of this interfaces which uses red-black tree.

None of this classes exist in .NET BCL per se, but I think those can be composed out of simpler primitives. Specifically, C5 Generic Collection Library provides an implementation of a red-black tree, and bidirectional map can be implemented on top of a standard Dictionary<TKey, TValue>.

Anton Gogolev