public static ArrayList<String>[] createList() {
//write your code here
ArrayList<String>[] list = new ArrayList[5];
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
list[i].add(i + " " + j);
}
}
return list;
}
package com.codegym.task.task10.task1015;
import java.util.ArrayList;
/*
Array of string lists
*/
public class Solution {
public static void main(String[] args) {
ArrayList<String>[] arrayOfStringList = createList();
printList(arrayOfStringList);
}
public static ArrayList<String>[] createList() {
//write your code here
ArrayList<String>[] list = new ArrayList[5];
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
list[i].add(i + " " + j);
}
}
return list;
}
public static void printList(ArrayList<String>[] arrayOfStringList) {
for (ArrayList<String> list : arrayOfStringList) {
for (String s : list) {
System.out.println(s);
}
}
}
}