Top "Immutability" questions

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

How to avoid "too many parameters" problem in API design?

I have this API function: public ResultEnum DoSomeAction(string a, string b, DateTime c, OtherEnum d, string e, string f, …

c# data-structures immutability
Why can tuples contain mutable items?

If a tuple is immutable then why can it contain mutable items? It is seemingly a contradiction that when a …

python list tuples immutability
Immutable numpy array?

Is there a simple way to create an immutable NumPy array? If one has to derive a class from ndarray …

python arrays numpy immutability readonly
SetState of an array of Objects in React

Ok, so I'm so frustrated finding the right solution so I'm posting the problem here. Giving an answer would help …

reactjs immutability setstate
How to create immutable objects in C#?

In a question about Best practices for C# pattern validation, the highest voted answer says: I tend to perform all …

c# validation entity-framework-4 immutability
scala class constructor parameters

What's the difference between: class Person(name: String, age: Int) { def say = "My name is " + name + ", age " + age } and class …

scala constructor scope immutability
Why would one declare an immutable class final in Java?

I read that to make a class immutable in Java, we should do the following, Do not provide any setters …

java immutability final
Hashable, immutable

From a recent SO question (see Create a dictionary in python which is indexed by lists) I realized I probably …

python data-structures hash immutability
What's the difference between Collections.unmodifiableSet() and ImmutableSet of Guava?

JavaDoc of ImmutableSet says: Unlike Collections.unmodifiableSet, which is a view of a separate collection that can still change, an …

java immutability guava
Why are Python strings immutable? Best practices for using them

What are the design reasons of making Python strings immutable? How does it make programming easier? I'm used to mutable …

python string immutability