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://
You can import the org.omg.CORBA package(or just the class you need) and in it you can use the Holder classes.
For example, it has the "IntHolder" where the field where it stores the integer is public, giving access to modify it.
public static void triple(IntHolder x){
x.value = 3 * x.value;
}
IntHolder mutableInt = new IntHolder(10);
triple(mutableInt);
System.out.println(mutableInt.value);
It also has "LongHolder" and "DoubleHolder" and tons of others that you can use. Use with caution.
Here is the api for it: https://docs.oracle.com/javase/7/docs/api/org/omg/CORBA/package-summary.html