[res] Reuse memory in RebuildFilterList()

Original code deleted all allocated arrays to new' them back
right away. Now, with new methods in ByteBucketArray the code
only clears the vectors without releasing the capacity, and then
proceeds to free the vectors that ended up not being used.

This speeds up theme changes (accents / dark theme etc) by
about 20%

+ small other improvements in ByteBucketArray

Bug: 237583012
Test: build + UTs + boot
Change-Id: I158af793e5476b4f3215dbe602daa872136d633f
3 files changed