scala - What's wrong with the expression `new ListBuffer.empty[Int]` -


i found works well:

val buf = scala.collection.mutable.listbuffer.empty[int] 

but, doesn't work:

import scala.collection.mutable.listbuffer val buf = new listbuffer.empty[int] 

the compiler complains:

error:(2, 32) type empty not member of object scala.collection.mutable.listbuffer lazy val buf = new listbuffer.empty[int]                               ^ 

does have ideas this?

listbuffer.empty isn't constructor, it's function returns empty listbuffer.

there's no need new keyword.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -