Does `Dictionary.Keys.contains(_:)` have `O(1)` time complexity?

Beware, this is also true for Set and Dictionary, when they contain values with reference semantics. Cocoa handles this with NSCopying; Swift prefers encouraging the use of value types instead.

4 Likes