I need to build up a list very quickly. My idea was to use a mutable.LinkedList and grow by prepending. However I found only the operator +: for prepending and it produces a copy of the list, which is surprising, given that the list is mutable.
Is there a way to prepend and modify the list in place?
I think this is how you are supposed to use it, from a quick glance:
val newList = new LinkedList(newElem, existingList)
Note though that it is deprecated in Scala 2.11 and might get removed in the future.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.