Example #1
0
 internal ImHashMap <K, V> Update(int hash, K key, V value, Update <V> update)
 {
     return(Height == 0
         ? this
         : hash == Hash
             ? ReferenceEquals(Key, key) || Key.Equals(key)
                 ? new ImHashMap <K, V>(
                new Data(hash, key, update == null ? value : update(Value, value), Conflicts), Left, Right)
                 : UpdateValueAndResolveConflicts(key, value, update, true)
             : (hash < Hash
                 ? With(Left.Update(hash, key, value, update), Right)
                 : With(Left, Right.Update(hash, key, value, update)))
            .KeepBalance());
 }