Files
rr3-apk/decompiled-community/sources/com/google/protobuf/MapFieldLite.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

170 lines
4.9 KiB
Java

package com.google.protobuf;
import com.google.protobuf.Internal;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
/* loaded from: classes3.dex */
public final class MapFieldLite<K, V> extends LinkedHashMap<K, V> {
private static final MapFieldLite<?, ?> EMPTY_MAP_FIELD;
private boolean isMutable;
public static <K, V> MapFieldLite<K, V> emptyMapField() {
return (MapFieldLite<K, V>) EMPTY_MAP_FIELD;
}
public boolean isMutable() {
return this.isMutable;
}
public void makeImmutable() {
this.isMutable = false;
}
private MapFieldLite() {
this.isMutable = true;
}
private MapFieldLite(Map<K, V> map) {
super(map);
this.isMutable = true;
}
static {
MapFieldLite<?, ?> mapFieldLite = new MapFieldLite<>();
EMPTY_MAP_FIELD = mapFieldLite;
mapFieldLite.makeImmutable();
}
public void mergeFrom(MapFieldLite<K, V> mapFieldLite) {
ensureMutable();
if (mapFieldLite.isEmpty()) {
return;
}
putAll(mapFieldLite);
}
@Override // java.util.LinkedHashMap, java.util.HashMap, java.util.AbstractMap, java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
return isEmpty() ? Collections.emptySet() : super.entrySet();
}
@Override // java.util.LinkedHashMap, java.util.HashMap, java.util.AbstractMap, java.util.Map
public void clear() {
ensureMutable();
super.clear();
}
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
public V put(K k, V v) {
ensureMutable();
Internal.checkNotNull(k);
Internal.checkNotNull(v);
return (V) super.put(k, v);
}
public V put(Map.Entry<K, V> entry) {
return put(entry.getKey(), entry.getValue());
}
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
public void putAll(Map<? extends K, ? extends V> map) {
ensureMutable();
checkForNullKeysAndValues(map);
super.putAll(map);
}
@Override // java.util.HashMap, java.util.AbstractMap, java.util.Map
public V remove(Object obj) {
ensureMutable();
return (V) super.remove(obj);
}
private static void checkForNullKeysAndValues(Map<?, ?> map) {
for (Object obj : map.keySet()) {
Internal.checkNotNull(obj);
Internal.checkNotNull(map.get(obj));
}
}
private static boolean equals(Object obj, Object obj2) {
if ((obj instanceof byte[]) && (obj2 instanceof byte[])) {
return Arrays.equals((byte[]) obj, (byte[]) obj2);
}
return obj.equals(obj2);
}
public static <K, V> boolean equals(Map<K, V> map, Map<K, V> map2) {
if (map == map2) {
return true;
}
if (map.size() != map2.size()) {
return false;
}
for (Map.Entry<K, V> entry : map.entrySet()) {
if (!map2.containsKey(entry.getKey()) || !equals(entry.getValue(), map2.get(entry.getKey()))) {
return false;
}
}
return true;
}
@Override // java.util.AbstractMap, java.util.Map
public boolean equals(Object obj) {
return (obj instanceof Map) && equals((Map) this, (Map) obj);
}
private static int calculateHashCodeForObject(Object obj) {
if (obj instanceof byte[]) {
return Internal.hashCode((byte[]) obj);
}
if (obj instanceof Internal.EnumLite) {
throw new UnsupportedOperationException();
}
return obj.hashCode();
}
public static <K, V> int calculateHashCodeForMap(Map<K, V> map) {
int i = 0;
for (Map.Entry<K, V> entry : map.entrySet()) {
i += calculateHashCodeForObject(entry.getValue()) ^ calculateHashCodeForObject(entry.getKey());
}
return i;
}
@Override // java.util.AbstractMap, java.util.Map
public int hashCode() {
return calculateHashCodeForMap(this);
}
private static Object copy(Object obj) {
if (!(obj instanceof byte[])) {
return obj;
}
byte[] bArr = (byte[]) obj;
return Arrays.copyOf(bArr, bArr.length);
}
/* JADX WARN: Multi-variable type inference failed */
public static <K, V> Map<K, V> copy(Map<K, V> map) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
for (Map.Entry<K, V> entry : map.entrySet()) {
linkedHashMap.put(entry.getKey(), copy(entry.getValue()));
}
return linkedHashMap;
}
public MapFieldLite<K, V> mutableCopy() {
return isEmpty() ? new MapFieldLite<>() : new MapFieldLite<>(this);
}
private void ensureMutable() {
if (!isMutable()) {
throw new UnsupportedOperationException();
}
}
}