Why don't the wrapper classes for Primitives have a setter?
What is the reason why Wrapper classes (like Integer, Double, etc.) don't have a setter for their inner primitive value ? I am asking this because that kind of functionality would have simplified calculus, and have made the Java language a little more flexible . Let me give you some examples. 1) Let's take the following example: Integer x = new Integer(5); x++; The previous code behind the scenes is performing autoboxing . Something like: int x_tmp = x.intValue(); x_tmp++; x = new Integer(x_tmp); // Yes that's a new memory allocation Because of this problem doing calculus on Wrapper is slower