开发者

What's the equvalent to .Net ArrayList mutable type in Scala 2.8?

What type in Scala 2.8开发者_如何学JAVA can I use to store a list of values? In C# I'd use ArrayList.


As others have pointed out, you want an ArrayBuffer. In general, in Scala, a buffer is a resizable, mutable, linear collection of data. In addition to ArrayBuffer, a ListBuffer works like a C# or Java mutable list--and, in fact, JListWrapper wraps Java's List and works basically the same way.

A good source of documentation for the collections classes is the Collections API document. It describes the implementations in detail and suggests common use cases.


You use ArrayBuffer


You could use ArrayBuffer.

You can see other mutable collections here: scala.collections.mutable

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜