[swift-users] array.first vs. array[0]

Dave Abrahams dabrahams at apple.com
Thu Jan 21 15:36:30 CST 2016


on Thu Jan 21 2016, David Turnbull <dturnbull-AT-gmail.com> wrote:

> On Thu, Jan 21, 2016 at 12:23 PM, Dave Abrahams via swift-users <
> swift-users at swift.org> wrote:
>
>> Swift Dictionaries are documented as having O(1) lookup.
>>
>
> Only the lookup by index is O(1). Lookup by key is not specified. 

Then that's a bug in our documentation; please file a ticket!  It should
guarantee O(1) as long as the Dictionary isn't backed by NSDictionary
and the hash function is good.



More information about the swift-users mailing list