1
val list = new mutable.DoubleLinkedList[String]
list.add("foo")

This obviously cannot be compiled. How to fix this?

I spent some time with scaladoc, but it seems like the information on how to add an item to a list is a secret. Yes I am relatively new to scala and by the way I am completely frustrated with "syntax sugar" like :+, ++ and :::. It improves neither readability nor writability.

1
  • 1
    Technically :+, ++ and ::: are not syntactic sugar. ::: is motivated for performance reasons and :+ is priceless in match statements. Commented Apr 23, 2014 at 16:29

1 Answer 1

1

DoubleLinkedList is deprecated, use ArrayBuffer.

val list = new scala.collection.mutable.ArrayBuffer[String]
list += "foo"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.