I'm wondering how I can concatenate 4 string arrays in Java.
There is a question about this already. How can I concatenate two arrays in Java?
But I tried to replicate it but it does not work for me.
This is what my code looks like:
Calling the method:
concatAll(jobs1, jobs2, jobs3, jobs4);
The method itself:
public String[] concatAll(String[] jobsA, String[] jobsB, String[] jobsC, String[] jobsD) {
    int totalLength = jobsA.length;
    for (String[] array : jobsD) {
        totalLength += array.length;
    }
    String[] result = Arrays.copyOf(jobsA, totalLength);
    int offset = jobsA.length;
    for (String[] array : jobsD) {
        System.arraycopy(array, 0, result, offset, array.length);
        offset += array.length;
    }
    return result;
}
 
     
     
    