|
22 | 22 |
|
23 | 23 | import com.google.common.annotations.VisibleForTesting;
|
24 | 24 | import com.google.common.base.Preconditions;
|
| 25 | +import com.google.common.collect.Maps; |
| 26 | +import com.google.common.collect.Sets; |
25 | 27 | import com.google.common.io.BaseEncoding;
|
26 | 28 | import com.google.common.io.ByteStreams;
|
27 | 29 | import java.io.ByteArrayInputStream;
|
|
32 | 34 | import java.util.Arrays;
|
33 | 35 | import java.util.BitSet;
|
34 | 36 | import java.util.Collections;
|
35 |
| -import java.util.HashMap; |
36 |
| -import java.util.HashSet; |
37 | 37 | import java.util.Iterator;
|
38 | 38 | import java.util.List;
|
39 | 39 | import java.util.Locale;
|
@@ -325,7 +325,7 @@ public Set<String> keys() {
|
325 | 325 | if (isEmpty()) {
|
326 | 326 | return Collections.emptySet();
|
327 | 327 | }
|
328 |
| - Set<String> ks = new HashSet<>(size); |
| 328 | + Set<String> ks = Sets.newHashSetWithExpectedSize(size); |
329 | 329 | for (int i = 0; i < size; i++) {
|
330 | 330 | ks.add(new String(name(i), 0 /* hibyte */));
|
331 | 331 | }
|
@@ -526,7 +526,7 @@ public void merge(Metadata other) {
|
526 | 526 | public void merge(Metadata other, Set<Key<?>> keys) {
|
527 | 527 | Preconditions.checkNotNull(other, "other");
|
528 | 528 | // Use ByteBuffer for equals and hashCode.
|
529 |
| - Map<ByteBuffer, Key<?>> asciiKeys = new HashMap<>(keys.size()); |
| 529 | + Map<ByteBuffer, Key<?>> asciiKeys = Maps.newHashMapWithExpectedSize(keys.size()); |
530 | 530 | for (Key<?> key : keys) {
|
531 | 531 | asciiKeys.put(ByteBuffer.wrap(key.asciiName()), key);
|
532 | 532 | }
|
|
0 commit comments