pure-jcore/src/main/java/leetcode/FourSum.java
/**
     * Convert List of int[3] to 2d array with each containing 3 elements.
     */
Convert List of int[3] to 2d array with each containing 3 elements.
Convert List of int [ 3 ] to 2d array with each containing 3 elements .
private int[][] convertListTo2dArrayWithEachOf3Elements(List<List<int[]>> fullList) {
        int totalSize = 0;
        for (List<int[]> subList : fullList) {
            totalSize += subList.size();
        }
        int[][] results = new int[totalSize][3];
        int i = 0;
        for (List<int[]> subList : fullList) {
            for (int[] pair : subList) {
                results[i][0] = pair[0];
                results[i][1] = pair[1];
                results[i][2] = pair[2];
                i++;
            }
        }
        return results;
    }
private int [ ] [ ] convertListTo2dArrayWithEachOf3Elements ( List < List < int [ ] > > fullList ) { int totalSize = 0 ; for ( List < int [ ] > subList : fullList ) { totalSize += subList . size ( ) ; } int [ ] [ ] results = new int [ totalSize ] [ 3 ] ; int i = 0 ; for ( List < int [ ] > subList : fullList ) { for ( int [ ] pair : subList ) { results [ i ] [ 0 ] = pair [ 0 ] ; results [ i ] [ 1 ] = pair [ 1 ] ; results [ i ] [ 2 ] = pair [ 2 ] ; i ++ ; } } return results ; }
Convert List of int[3] to 2d array with each containing 3 elements.
Convert List of int [ 3 ] to 2d array with each containing 3 elements .