Mutable vs immutable objects
Well, there are a few aspects to this. Mutable objects without reference-identity can cause bugs at odd times. For example, consider a Person bean with a value-based equals method: Map<Person, String> map = … Person p = new Person(); map.put(p, “Hey, there!”); p.setName(“Daniel”); map.get(p); // => null The Person instance gets “lost” in the map … Read more