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

查看:48
本文介绍了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天全站免登陆