I would like to concatenate an array in Java by reference like so.
int[] a = new int[] {1,2,3};
int[] b = new int[] {4,5,6};
int[] ab = concatArrayByReference(a,b); //Function to be defined
now if I do
a[2] = 90;
ab should be equal to {1,2,90,4,5,6}
Is this possible in Java, and what about splitting an array by reference?
I want this mostly for performance reasons, I would like to avoid copying the two extremely big arrays each time I concatenate them.
Edit: it seems it is not possible in Java, then how would I go about making a high performance implementation of List to make this possible?