Top "Immutability" questions

Immutability is the inability to modify data after it has been created.

Why do we need immutable class?

I am unable to get what are the scenarios where we need an immutable class. Have you ever faced any …

java design-patterns immutability
Why is immutability so important (or needed) in JavaScript?

I am currently working on React JS and React Native frameworks. On the half way road I came across Immutability …

javascript reactjs functional-programming immutability immutable.js
.clone() or Arrays.copyOf()?

In an effort to reduce mutability, should we rather use public void setValues(String[] newVals) { this.vals = ( newVals == null ? null : …

java immutability
How do I work around mutability in moment.js?

I've run into a problem where I have to store the initial values of a moment object but I'm having …

javascript object immutability momentjs mutability
In C#, why can't I modify the member of a value type instance in a foreach loop?

I know that value types should be immutable, but that's just a suggestion, not a rule, right? So why can't …

c# foreach immutability value-type
What does immutable mean?

If a string is immutable, does that mean that.... (let's assume JavaScript) var str = 'foo'; alert(str.substr(1)); // oo alert(…

javascript variables immutability
immutable strings vs std::string

I've recent been reading about immutable strings Why can't strings be mutable in Java and .NET? and Why .NET String …

c++ string immutability
Immutable Object with ArrayList member variable - why can this variable be changed?

I have got one class with various member variables. There is a constructor and there are getter-methods, but no setter-methods. …

java object immutability member getter-setter
Can I change String object's value passed to my method?

I found the following question Is Java "pass-by-reference" or "pass-by-value"?. I read almost all of it, but could not find …

java string parameters pass-by-reference immutability
Does Haskell have variables?

I've frequently heard claims that Haskell doesn't have variables; in particular, this answer claims that it doesn't, and it was …

variables haskell immutability monads referential-transparency