- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
ListBuffer.++, and List.+
Sat, 2009-01-10, 23:01
I think this should be made to work:
val x = new ListBuffer[Int]
x += 1
x ++ x
Now it throws an OOME.
Also, when I try this:
val x = List(1)
x += 2
I get a compiler error "reassignment to val".
But there is no "+=" method defined in list, only "+". Does the compiler
treat "x += y", when there is no x.+= method, as "x = x + y"?
Thanks,
Dimitris
2009/1/10 Dimitris Andreou <jim.andreou@gmail.com>