<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Sequence.underestimatedCount is supposed to work at O(1) time, according to the docs on Apple’s developer website. On the other hand, Collection.count works at O(n) time, except for RandomAccessCollection where it can work at O(1) time. I’ve been playing around with creating various Collection types, and it seem that their underestimatedCount has a default implementation that just dumps to count, even when the latter is O(n)!</div><div class=""><br class=""></div><div class="">I think that underestimatedCount should call count only for RandomAccessCollection, while Collection and BidirectionalCollection call isEmpty as needed. Is this a good idea? Should I post a bug report (somewhere)?</div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">—&nbsp;</div><div class="">Daryle Walker<br class="">Mac, Internet, and Video Game Junkie<br class="">darylew AT mac DOT com&nbsp;</div></div>
</div>
<br class=""></body></html>