mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-13 09:27:16 +01:00
45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
package dagger.internal;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes9.dex */
|
|
public final class DaggerCollections {
|
|
private static final int MAX_POWER_OF_TWO = 1073741824;
|
|
|
|
private DaggerCollections() {
|
|
}
|
|
|
|
private static int calculateInitialCapacity(int i) {
|
|
if (i < 3) {
|
|
return i + 1;
|
|
}
|
|
if (i < 1073741824) {
|
|
return (int) ((i / 0.75f) + 1.0f);
|
|
}
|
|
return Integer.MAX_VALUE;
|
|
}
|
|
|
|
public static boolean hasDuplicates(List<?> list) {
|
|
if (list.size() < 2) {
|
|
return false;
|
|
}
|
|
return list.size() != new HashSet(list).size();
|
|
}
|
|
|
|
public static <T> HashSet<T> newHashSetWithExpectedSize(int i) {
|
|
return new HashSet<>(calculateInitialCapacity(i));
|
|
}
|
|
|
|
public static <K, V> LinkedHashMap<K, V> newLinkedHashMapWithExpectedSize(int i) {
|
|
return new LinkedHashMap<>(calculateInitialCapacity(i));
|
|
}
|
|
|
|
public static <T> List<T> presizedList(int i) {
|
|
return i == 0 ? Collections.EMPTY_LIST : new ArrayList(i);
|
|
}
|
|
}
|