Java ArrayList Print printMatrix(ArrayList> grid)

Here you can find the source of printMatrix(ArrayList> grid)

Description

print Matrix

License

Open Source License

Declaration

public static void printMatrix(ArrayList<ArrayList<Integer>> grid) 

Method Source Code

//package com.java2s;
/**// w  w  w.  j a v  a 2s.c om
 * Copyright (C) 2018 Lars Dam
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation version 3.0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * See: http://www.gnu.org/licenses/gpl-3.0.html
 *  
 * Problemen in deze code:
 * - ... 
 * - ...
 */

import java.util.ArrayList;

public class Main {
    public static void printMatrix(ArrayList<ArrayList<Integer>> grid) {
        for (int r = 0; r < grid.size(); r++) {
            for (int c = 0; c < grid.get(r).size(); c++)
                System.out.print(grid.get(r).get(c) + "\t");
            System.out.println();
        }
    }

    public static void printMatrix(int grid[][]) {
        for (int r = 0; r < grid.length; r++) {
            for (int c = 0; c < grid[0].length; c++)
                System.out.print(grid[r][c] + "\t");
            System.out.println();
        }
    }

    public static void printMatrix(int grid[]) {
        for (int r = 0; r < grid.length; r++) {
            System.out.print(grid[r] + " \n");
        }
    }
}

Related

  1. printArrayList(ArrayList _array)
  2. printArrayListInt(ArrayList list)
  3. printComboBoxView(ArrayList alOptionValue, String sDefaultValue)
  4. printEdgeCycleMembership(final int[][] cyclesData, final ArrayList[] nodeCycleMembership)
  5. printListFlat(ArrayList list)
  6. printReport(ArrayList words, ArrayList searched)
  7. printStringArrayList(ArrayList list)
  8. writeArrayList(ArrayList objects, String separator, String final_conjunction, String prefix, String suffix)
  9. writeArrayListToScreen(ArrayList readArrrayList)