<blockquote>
<p>Range may reflect any mapping for that key from any point during the Range call.</p>
<p>Range may be O(N) with the number of elements in the map even if f returns false after a constant number of calls.</p>
</blockquote>
<p>The above is a quote from Golang.org documentation.
My question is regarding the usage of 'may be' and 'may'. Does 'may be' mean its not definite and its a possibility of that outcome or is there some other interpretation to it? Thanks in advance. </p>
<hr/>**评论:**<br/><br/>kune13: <pre><p>Values reported by Range reflect any mapping for that key during the Range call. There are no guarantees which mapping will be returned.</p>
<p>Range can be O(N) even if the user-provided function f returns false after a constant number of calls. Range copies dirty values and the effort for this cannot be controlled by returning false in f.</p></pre>Sythe2o0: <pre><p>Well, given there is a chance it could be O(N), that implies the worst case scenario is that it takes N time, or in other words, it's always O(N).</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传