I am trying to create an Arraylist which has array of Strings at each index. I have used following code:
ArrayList<String[]> deliveryTimes = new ArrayList<String[]>();
String[] str = new String[times.size()];//times is an Arraylist of string
for(int i=0; i<times.size();i++){
str[i] = times.get(i);
}
deliveryTimes.add(str);
With above code all the elements of str array are added at different index in deliveryTimes arraylist. But I want to add str as array at a index. So it should be like following:
[["a","b","c"],["aa","bb","cc"],["aaa","bbb","ccc"]]
But it is like:
["a","b","c","aa","bb","cc","aaa","bbb","ccc"]