Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala 2.11 LinkedList is deprecated, what should I use?

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.

What should I use?

like image 613
David Frank Avatar asked Dec 18 '14 23:12

David Frank


1 Answers

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

like image 112
suztomo Avatar answered Sep 30 '22 00:09

suztomo