The integer passed to the constructor represents its initial capacity, i.e., the number of elements it can hold before it needs to resize its internal array (and has nothing to do with the initial number of elements in the list).
To initialize an list with 60 zeros you do:
List<Integer> list = new ArrayList<Integer>(Collections.nCopies(60, 0));
If you want to create a list with 60 different objects, you could use the Stream API with a Supplier
as follows:
List<Person> persons = Stream.generate(Person::new)
.limit(60)
.collect(Collectors.toList());
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…