为什么Google Collections中没有SortedMultiset? [英] Why no SortedMultiset in Google Collections?

查看:142
本文介绍了为什么Google Collections中没有SortedMultiset?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Collections 包含 Multiset 接口和 TreeMultiset 类,但我很惊讶地发现没有相应的 SortedMultiset 接口。

Google Collections contains the Multiset interface and the TreeMultiset class, but I was surprised to find that there is no corresponding SortedMultiset interface.

这样的东西对于建立离散概率分布非常有用。

Something like that would be very useful for modelling discrete probability distributions.

在我尝试自己实现它之前,我想知道是否有一个特定的理由将其遗漏,例如可能违反 Multiset Collection 不变量,或固有的性能问题等。

Before I attempt to implement it myself, I would like to know if there is a specific reason for leaving it out, e.g. likely violation of Multiset or Collection invariants, or inherent performance problems etc.

编辑:我最初没有意识到这一点,但这实际上是3个单独的请求:

Edit: I didn't realise it originally but this is actually 3 separate requests:


  1. 更改一种方法的返回类型( TreeMultiset.entrySet

  2. 一个新的接口,用于匹配 TreeMultiset的现有功能

  3. 一对新的方法,用于对树的分支中的计数求和


推荐答案

我认为这还没有人需要它,所以我们还没写过然而。这是我考虑的事情。

I think it's just that no one's ever needed it yet, so we haven't written it yet. It's something I'd consider.

这篇关于为什么Google Collections中没有SortedMultiset?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆