I have an ArrayList<String[]> array_list
I want to convert it into a 2D String array say result
such that first string array in array_list is in result[0].
Also I want to have first string in result to be equal to string equal.
i.e.
If first array in array_list has ["A","B","C"]
and my string equal is "D" my result[0] should be ["D","A","B","C"]
I tried:
ArrayList<String[]> result = new ArrayList<String[]>();
// I'm getting value of result from a function
String[][] array = new String[result.size()][];
int j =0;
for (String[] arrs : result)
{
System.out.println(j);
String arr = n;//I have taken n as parameter for the function
array[j][0] = arr;
int i =1;
for(String o : arrs)
{
array[j][i] = o;
i++;
}
j++;
}
but this gives java.lang.NullPointerException.