Method to enable capacity pre-allocation for the collections. Copied from gluck's fork.