Thomas Mueller - 2013-10-01

Is there any way to initialize a TStCollection with a given size? Like setting TList.Capacity?
I need to initialize it with the numbers from 0 to SomeMaximum, so with TList, I would use

List.Capacity := SomeMaximum + 1;
for i := 0 to SomeMaximum do

With TStCollection I currently have this code:

for i := 0 to SomeMaximum do
Coll[i] := Pointer(i);

This is taking some unnecessary time because the collection has to allocate pages every time it runs out of space. I would like to reduce this overhead by creating all necessary pages initially.