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

smuggledPancakes picture smuggledPancakes · Dec 23, 2010 · Viewed 57k times · Source

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

Alex Jasmin picture Alex Jasmin · Dec 23, 2010

You could always wrap the value in an array like int[] mutable = {1}; if including the code for a mutable wrapper class is too cumbersome.