开发者

NSMutableDictionary with capacity

开发者 https://www.devze.com 2023-01-12 11:45 出处:网络
What happens when you try to add to an NSMutableDictionary once it h开发者_运维百科as already reached its capacity limit of objects? Does this bump one out or is this going to throw an exception? Also

What happens when you try to add to an NSMutableDictionary once it h开发者_运维百科as already reached its capacity limit of objects? Does this bump one out or is this going to throw an exception? Also is there any way to have it bump out the oldest dictionary object when I add a new one?


It bumps it up. The capacity in the constructor is only the initial capacity.

This page has the following snippet:

initWithCapacity:
: : : : :
Discussion: Mutable dictionaries allocate additional memory as needed, so numItems simply establishes the object’s initial capacity.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号