0

I have small problem. I want to show all tables in my ArrayList

The code:

Integer[] numbers = {4, 7, 2, 1, 14, 23, 10, 5};


ArrayList<Integer[]> list = new ArrayList<>();

    list.add(numbers);
    list.add(numbers);
    list.add(numbers);
    list.add(numbers);

    System.out.println(list.size());

    show(list);

public static <T> void show(ArrayList<Integer[]> arg){
    for (Integer[] i: arg){
        System.out.println(i.toString());

        }

All i see is:

[Ljava.lang.Integer;@60e53b93
[Ljava.lang.Integer;@60e53b93
[Ljava.lang.Integer;@60e53b93
[Ljava.lang.Integer;@60e53b93

Use toString to view all records?

Thank's for help.

1 Answers1

1

Just change your show method as below. Hope this will help you.

public static <T> void show(ArrayList<Integer[]> arg) {

    for (final Integer[] i : arg) {
        System.out.println("\n");
        for (int j = 0; j < i.length; j++) {
            System.out.print(j + "\t");
        }
    }
}
Nishant Bhardwaz
  • 924
  • 8
  • 21