It is very hard to find an example where this isn’t the case. Nobody wants do that, if a mutable type is received, everyone makes copy before storing it…

Here some blunder:

class Holder {

 public Object m;	void setList(List a) {

 	m= Collections.unmodifiableList(a);

 }

}

now we try something:

 	Holder h = new Holder();

 	List a = new ArrayList(){

 		{add("a");}

 	};

 	h.setList(a);

 	a.add("b");

 	System.out.println(h.m);

What gets printed? No, “[a,b]” gets printed, this means that the state of Holder can be changed from the outside. Even if there is some value checking (and m being private), after Holder releases control anything can happen.

This obviously break encapsulation and thus can’t be good OO.

Builders

Sometimes we have to receive an object that can be manipulated outside. There are two principal categories: IO and Builders. IO is always a sensitive point and everyone knows that and hopefully takes extra care. Builder collect information necessary for object construction, but there is a distinct point when the Builder is passed back and there the object construction should happen immediately or the builder needs to get locked.