为什么 Scala 中没有可变的 TreeMap? [英] Why is there no mutable TreeMap in Scala?

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

问题描述

是时间不够、技术问题还是不存在的原因?

Is it lack of time, some technical problem or is there a reason why it should not exist?

推荐答案

这只是一个缺失的案例,大概最终会被填补.没有理由不这样做,在某些情况下,它会比不可变树(因为修改需要使用不可变树创建 log(n) 个对象,而使用可变树只需要 1 个).

It's just a missing case that will presumably eventually be filled in. There is no reason not to do it, and in certain cases it would be considerably faster than the immutable tree (since modifications require log(n) object creations with an immutable tree and only 1 with a mutable tree).

实际上是在2.12填写的.

and in fact it was filled in in 2.12.

可变树图.

(也有对应的Set.)

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

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