Make PackageKetSetData use erase
In ArrayMap, it's possible to manually iterate the backing array but the behavior is undefined when you start removing values that don't actually exist in the map. It doesn't resize on every removal, so it's possible to add N values, remove > 1, and then successfully remove N-1, although it realistically does nothing but null an already null element. This depends on how the map has decided to resize itself, and may or may not crash. This uses erase rather than clear to prevent clearing and re-allocating the array. The common use case is simply replacing the values in the map, so this preserves size. Bug: 128012139 Test: manual test removeAllDefinedKeySets Change-Id: I8fe75ba64ebd2a97c668249301517abb57627101
Loading
Please register or sign in to comment