Skip to content

Commit 2ca790a

Browse files
committedSep 21, 2018
Avoid new ArrayList(collection) in Registry
Fixes #3296 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=213286385
1 parent b3b2d7a commit 2ca790a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎library/src/main/java/com/bumptech/glide/Registry.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ public <Data, TResource> Registry prepend(
265265
// Final to avoid a PMD error.
266266
@NonNull
267267
public final Registry setResourceDecoderBucketPriorityList(@NonNull List<String> buckets) {
268-
List<String> modifiedBuckets = new ArrayList<>(buckets);
268+
// See #3296 and https://bugs.openjdk.java.net/browse/JDK-6260652.
269+
List<String> modifiedBuckets = new ArrayList<>(buckets.size());
270+
modifiedBuckets.addAll(buckets);
269271
modifiedBuckets.add(0, BUCKET_PREPEND_ALL);
270272
modifiedBuckets.add(BUCKET_APPEND_ALL);
271273
decoderRegistry.setBucketPriorityList(modifiedBuckets);

0 commit comments

Comments
 (0)
Please sign in to comment.