When I pass an immutable type object(String, Integer,.. ) as final to a method I can achieve the characters of a C++ constant pointer. But how can I enforce such behavior in objects which are mutable?
public void someMethod(someType someObject){
/*
* code that modifies the someObject's state
*
*/
}
All I want is to prevent someMethod from modifying the state of someObject without making any change in someType. Is this possible?