public BijectiveMap( BijectiveMap <TKey, TValue> bijectiveMap, IEqualityComparer <TKey> keyComparer, IEqualityComparer <TValue> valueComparer) { if (bijectiveMap is null) { throw new ArgumentNullException(nameof(bijectiveMap)); } KeyDictionary = new Dictionary <TKey, TValue>( bijectiveMap.KeyDictionary, keyComparer); ValueDictionary = new Dictionary <TValue, TKey>( bijectiveMap.ValueDictionary, valueComparer); KeyComparer = keyComparer ?? EqualityComparer <TKey> .Default; ValueComparer = ValueComparer ?? EqualityComparer <TValue> .Default; Reverse = new BijectiveMap <TValue, TKey>(this); }
public BijectiveMap( int capacity, IEqualityComparer <TKey> keyComparer, IEqualityComparer <TValue> valueComparer) { KeyDictionary = new Dictionary <TKey, TValue>( capacity, keyComparer); ValueDictionary = new Dictionary <TValue, TKey>( capacity, valueComparer); KeyComparer = keyComparer ?? EqualityComparer <TKey> .Default; ValueComparer = ValueComparer ?? EqualityComparer <TValue> .Default; Reverse = new BijectiveMap <TValue, TKey>(this); }
private BijectiveMap(BijectiveMap <TValue, TKey> reverse) { ValueDictionary = reverse.KeyDictionary; KeyDictionary = reverse.ValueDictionary; Reverse = reverse; }
public BijectiveMap(BijectiveMap <TKey, TValue> bijectiveMap) : this(bijectiveMap, null, null) { }