weixin_39900531 2020-11-29 14:53
浏览 0

Add public APIs for `SortedSet`

Since SortedSet is a "set", it should support the same interface as Set. At the same time, since it is ordered, a number of "indexed", Array-like methods will also make sense. To finish off, I want to add methods for iterating over all the items greater than, greater-than-or-equal, less than, or less-than-or-equal to a provided argument.

该提问来源于开源项目:hamstergem/hamster

  • 写回答

5条回答 默认 最新

  • weixin_39900531 2020-11-29 14:53
    关注

    Any suggestions what the methods for iterating over keys less-than, less-than-or-equal, etc. to a given key should be called?

    If a block is provided, I intend to make these methods yield the appropriate items and then return self. If no block is provided, they will return a new SortedSet. This can be done quite efficiently.

    评论

报告相同问题?