[cleanup] Preallocate memory in CollectionUtils + cache the collection sizes for iteration Bug: 282215580 Test: build + boot + perf record Change-Id: I1c7b205395e92989d3584554d77ed8140d967651