What is the best way to do the following:
List<MyObject> list = new LinkedList<MyObject>();
for(int i=0; i<30;i++)
{
MyObject o1 = new MyObject();
list.add(o1);
}
But I do not want to create objects with the same name, I want to create them with a different name, for example o1,o2,o3,o4,o5,o6,o7,o8,o9,o10, and I want to add them to the list. What is the best way to do this?
source
share