📅  最后修改于: 2022-03-11 14:52:09.448000             🧑  作者: Mango
// Using the range of int i we assign new objects to the List using i as the index
List objects = new ArrayList<>();
for (int i = 0; i < 10; i++)
{
// Generate or get variables
objects.add(i, new Object(variable, variable1));
}