issue-44801 EnsureCapacity Apis For List Stack Queue (#47149)
* issue-44801 Initial commit: public List.EnsureCapacity. * Create Stack.EnsureCapacity(). * issue-44801 Fix comment for Stack. * issue-44801 Fix comment: Move temp MaxArrayLength into near usage scope for Stack. * issue-44801 Fix comment for List. * issue-44801 Create EnsureCapacity for Queue. * issue-44801 Create tests for List.EnsureCapacity. * issue-44801 Create tests for Stack.EnsureCapacity. * issue-44801 Create tests for Queue.EnsureCapacity. * issue-44801 Update version if updating internal buffer. * issue-44801 Update test cases to verify invalidating enumeration (List, Stack, Queue). * issue-44801 Improve code change for List: 1. Avoid incrementing version number twice in one Insert (or Add) method call; 2. Avoid more capacity check for Insert (or Add) method. * issue-44801 Fix comments: consider integer overflow; refactor methods. * Update src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs Fix comment: update xml doc. Co-authored-by: NEirik Tsarpalis <eirik.tsarpalis@gmail.com> * ensure same algorithm is used for all resize operations * revert array length check in List.EnsureCapacityCore * remove GrowFactor constant * skip large capacity tests on mono. * Fix overflow handling when capacity < MaxArrayLength; add clarifying comments Co-authored-by: NEirik Tsarpalis <eirik.tsarpalis@gmail.com>
Showing
想要评论请 注册 或 登录