I have a method that takes in a nested ArrayList of Strings as a parameter as given below:
public static String methodName(ArrayList<ArrayList<String>> param1,ArrayList<Integer> param2){
...some logic
}
I want to test this method with an input
input :"param1"= [
["HTML", "C#"],
["C#", "Python"],
["Python", "HTML"]
]
"param2"= [0, 0, 1]
I searched online and found this : How do I declare a 2D String arraylist?
Here is what I tried:
public static void main(String[] args){
ArrayList<ArrayList<String>> param1 = ...what should I put here?
List<List<String>> list = new ArrayList<List<String>>();
List<String> input = new ArrayList<String>();
input.add({"HTML", "C#"});//does not compile ... array initializer not allowed here
input.add({"C#", "Python"});
input.add({"Python", "HTML"});
How would you add the input to the nested ArrayList? Would appreciate any help...