I\'m aware that a common performance refactoring is to replace simple for\'s by System.arraycopy.
I want to ask about:
Whe
In my use case this
public T[][] arrayCopy(T[][] array) {
return Arrays.stream(array).
map(el -> el.clone()).toArray(a -> array.clone());
}
was way faster than using System.arraycopy or the straight forward two for loops solution.
Also tested with primitives ( arrayCopy(int[][] array) ) and got the same result.