I have one doubt in java, can we create dynamic ArrayList or String[] inside a for-loop. For example in my app there are categories field is there (not static, obtaining from server), I want to create ArrayList or String[] object based on size of categories. How can I create a dynamic ArrayList in side a loop?
My code is as follows:
for(int i =0; i<20; i++)
{
ArrayList <String> list(i) = new ArrayList<String>();
}
can we create an object like this? based on category position, I can call the list items like list(positon), can we do like this java?
ArrayListwas already dynamic enough