File tree Expand file tree Collapse file tree
src/main/java/com/reandroid/arsc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,6 +201,13 @@ public void linkSpecStringsInternal(SpecStringPool specStringPool) {
201201
202202 public void merge (EntryItemList itemList ) {
203203 if (itemList != null && itemList != this ) {
204+ int capacity ;
205+ if (this .isSparse ()) {
206+ capacity = itemList .size ();
207+ } else {
208+ capacity = itemList .getHighestEntryId () + 1 - size ();
209+ }
210+ ensureCapacity (capacity );
204211 Iterator <Entry > iterator = itemList .iterator (true );
205212 while (iterator .hasNext ()) {
206213 Entry comingBlock = iterator .next ();
Original file line number Diff line number Diff line change @@ -377,6 +377,7 @@ public void merge(StringPool<T> stringPool) {
377377 return ;
378378 }
379379 ensureStringLinkUnlockedInternal ();
380+ getStringsArray ().ensureCapacity (stringPool .size ());
380381 for (T stringItem : stringPool ) {
381382 if (!containsInternal (stringItem )) {
382383 createNewString ().merge (stringItem );
You can’t perform that action at this time.
0 commit comments