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

前端 未结 7 1549
野趣味
野趣味 2020-12-01 15:48

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://

7条回答
  •  抹茶落季
    2020-12-01 15:55

    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. Additionally, it is really easy to implement it. For example, commons-lang has a MutableInt.

提交回复
热议问题