Scala 2.11 LinkedList已弃用,我应该使用什么? [英] Scala 2.11 LinkedList is deprecated, what should I use?

查看:1944
本文介绍了Scala 2.11 LinkedList已弃用,我应该使用什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据文档 scala.collection.mutable.LinkedList 从2.11版本起已弃用。不幸的是,我没有找到任何替代它。我需要一个有序集合,可以在固定时间从任何索引中删除一个项目。

According to the docs, scala.collection.mutable.LinkedList is deprecated as of the 2.11 version. Unfortunately I have found nothing to replace it with. I need an ordered collection that can remove an item from any index in constant time.

我应该使用什么?

推荐答案

使用MutableList及其迭代器的 remove 方法。他们提供O(1)删除。

Use MutableList and its iterator's remove method. They provide O(1) removal.

http://docs.scala-lang.org/overviews/collections/concrete-mutable-collection-classes.html#linked_lists

这篇关于Scala 2.11 LinkedList已弃用,我应该使用什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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