5 ms·
val immutableString = "foo" val immutableList = List(1, 2, 3) val immutableMap = Map("foo" -> "bar") var mutableString = "foo" val mutableList = collection.
by mark242 11y ago
val immutableString = "foo"
val immutableList = List(1, 2, 3)
val immutableMap = Map("foo" -> "bar")
var mutableString = "foo"
val mutableList = collection.mutable.List(1, 2, 3)
val mutableMap = collection.mutable.Map("foo" -> "bar")
- RyanZAG 11y agoNo, this is not the same as the linked library. See here: http://stackoverflow.com/questions/6425165/statically-decide-if-a-scala-class-is-immutable http://stackoverflow.com/questions/6425165/statically-decide... A similar example in Scala would be a class that has only 'val' types and no 'var' types, but read through the stackoverflow post to see the complexities.