discord-jadx/app/src/main/java/d0/t/g0.java

63 lines
2.2 KiB
Java

package d0.t;
import d0.t.q0.c;
import d0.z.d.m;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import kotlin.Pair;
/* compiled from: MapsJVM.kt */
public class g0 extends f0 {
public static final <K, V> Map<K, V> build(Map<K, V> map) {
m.checkNotNullParameter(map, "builder");
return ((c) map).build();
}
public static final <K, V> Map<K, V> createMapBuilder() {
return new c();
}
public static final int mapCapacity(int i) {
if (i < 0) {
return i;
}
if (i < 3) {
return i + 1;
}
if (i < 1073741824) {
return (int) ((((float) i) / 0.75f) + 1.0f);
}
return Integer.MAX_VALUE;
}
public static final <K, V> Map<K, V> mapOf(Pair<? extends K, ? extends V> pair) {
m.checkNotNullParameter(pair, "pair");
Map<K, V> singletonMap = Collections.singletonMap(pair.getFirst(), pair.getSecond());
m.checkNotNullExpressionValue(singletonMap, "java.util.Collections.si…(pair.first, pair.second)");
return singletonMap;
}
public static final <K, V> Map<K, V> toSingletonMap(Map<? extends K, ? extends V> map) {
m.checkNotNullParameter(map, "$this$toSingletonMap");
Map.Entry<? extends K, ? extends V> next = map.entrySet().iterator().next();
Map<K, V> singletonMap = Collections.singletonMap(next.getKey(), next.getValue());
m.checkNotNullExpressionValue(singletonMap, "with(entries.iterator().…ingletonMap(key, value) }");
return singletonMap;
}
public static final <K extends Comparable<? super K>, V> SortedMap<K, V> toSortedMap(Map<? extends K, ? extends V> map) {
m.checkNotNullParameter(map, "$this$toSortedMap");
return new TreeMap(map);
}
public static final <K, V> SortedMap<K, V> toSortedMap(Map<? extends K, ? extends V> map, Comparator<? super K> comparator) {
m.checkNotNullParameter(map, "$this$toSortedMap");
m.checkNotNullParameter(comparator, "comparator");
TreeMap treeMap = new TreeMap(comparator);
treeMap.putAll(map);
return treeMap;
}
}