Scala Array constructor?

Posted by Lukasz Lew on Stack Overflow See other posts from Stack Overflow or by Lukasz Lew
Published on 2010-04-23T16:17:11Z Indexed on 2010/04/23 16:33 UTC
Read the original article Hit count: 413

Filed under:
|
|
scala> val a = Array [Double] (10)
a: Array[Double] = Array(10.0)

scala> val a = new Array [Double] (10)
a: Array[Double] = Array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)

Why these two expressions have different semantics?

© Stack Overflow or respective owner

Related posts about scala

Related posts about array