简体   繁体   中英

Changing multidimensional array of bytes to method for multidimensional arraylist

Here's some code I've been playing around with, I was wondering how i'd change the code so it'd do the same but for an ArrayList<byte[]>

 private static void transposeba(byte[][] m) {
        for (int i = 0; i < m.length; i++) {
            for (int j = i; j < m[0].length; j++) {
                byte x = m[i][j];
                m[i][j] = m[j][i];
                m[j][i] = x;
            }
        }
    }

such:

 private static void transposeba(ArrayList<byte[]> m)
private static void transposeba(List<byte[]> m) {
    for (int i = 0; i < m.size(); i++) {
        for (int j = i; j < m.get(0).length; j++) {
            byte x = m.get(i)[j];
            m.get(i)[j] = m.get(j)[i];
            m.get(j)[i] = x;
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM