I have a simple usage of var
variable with immutable.ListMap
type. Unfortunately a code complexity of a project does not give me a chance to move it to immutable val
On review I am getting a comment to change it to var
variable with mutable.ListMap
.
Like "you already have var
and mutable won't make thing worse."
What do you think about that? Are there any performance metrics or code style that prohibits using of mutable vars? What is really better to choose between mutable var
and immutable var
?
I have read all answers for
val-mutable versus var-immutable in Scala and noticed one comment that got lot of likes:
Prefer immutable val over immutable var over mutable val over mutable var
Are there any proofs or explanation for that statement?