smuggledPancakes smuggledPancakes - 3 months ago 20
Java Question

Does Java have mutable types for Integer, Float, Double, Long?

I am in a situation where I want to use mutable versions of things like Integer. Do I have to use these classes (below) or does Java have something built in?

http://www.java2s.com/Code/Java/Data-Type/Amutableintwrapper.htm

Answer

No, java doesn't have these built in. And that is for a reason. Using mutable types is dangerous as they can easily be misused. plus it is really easy to implement it. (commons-lang has MutableInt for example)