> On Nov 11, 2016, at 12:14 AM, Ray Fix via swift-users <swift-users@swift.org>
> wrote:
>
> The reason I don’t think it is provided is because it is difficult to know
> what to do when keys collide.
When you add a single entry to a dictionary with []=, it simply replaces any
existing value. I would expect adding multiple entries to do the same. (Which
is what NSDictionary’s -addEntries: method does.)
Sure, there are different policies you could want, like ignoring duplicate keys
or somehow combining the values, but replacing is a common default. It seems
wrong not to have this method just because there’s more than one way it could
work. (“Don’t let the best be the enemy of the good.”)
—Jens
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users