- 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
145 lines
5.8 KiB
Java
145 lines
5.8 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.collect.ImmutableMultimap;
|
|
import com.google.common.collect.ImmutableSet;
|
|
import com.google.common.collect.ImmutableSortedSet;
|
|
import com.google.common.collect.Serialization;
|
|
import java.io.IOException;
|
|
import java.io.InvalidObjectException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
import java.util.Collection;
|
|
import java.util.Comparator;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class ImmutableSetMultimap extends ImmutableMultimap implements Multimap {
|
|
private static final long serialVersionUID = 0;
|
|
public final transient ImmutableSet emptySet;
|
|
|
|
public static final class SetFieldSettersHolder {
|
|
public static final Serialization.FieldSetter EMPTY_SET_FIELD_SETTER = Serialization.getFieldSetter(ImmutableSetMultimap.class, "emptySet");
|
|
}
|
|
|
|
public static ImmutableSetMultimap of() {
|
|
return EmptyImmutableSetMultimap.INSTANCE;
|
|
}
|
|
|
|
public static final class Builder extends ImmutableMultimap.Builder {
|
|
public ImmutableSetMultimap build() {
|
|
Collection entrySet = this.builderMap.entrySet();
|
|
Comparator comparator = this.keyComparator;
|
|
if (comparator != null) {
|
|
entrySet = Ordering.from(comparator).onKeys().immutableSortedCopy(entrySet);
|
|
}
|
|
return ImmutableSetMultimap.fromMapEntries(entrySet, this.valueComparator);
|
|
}
|
|
}
|
|
|
|
public static ImmutableSetMultimap fromMapEntries(Collection collection, Comparator comparator) {
|
|
if (collection.isEmpty()) {
|
|
return of();
|
|
}
|
|
ImmutableMap.Builder builder = new ImmutableMap.Builder(collection.size());
|
|
Iterator it = collection.iterator();
|
|
int i = 0;
|
|
while (it.hasNext()) {
|
|
Map.Entry entry = (Map.Entry) it.next();
|
|
Object key = entry.getKey();
|
|
ImmutableSet valueSet = valueSet(comparator, (Collection) entry.getValue());
|
|
if (!valueSet.isEmpty()) {
|
|
builder.put(key, valueSet);
|
|
i += valueSet.size();
|
|
}
|
|
}
|
|
return new ImmutableSetMultimap(builder.buildOrThrow(), i, comparator);
|
|
}
|
|
|
|
public ImmutableSetMultimap(ImmutableMap immutableMap, int i, Comparator comparator) {
|
|
super(immutableMap, i);
|
|
this.emptySet = emptySet(comparator);
|
|
}
|
|
|
|
public static ImmutableSet valueSet(Comparator comparator, Collection collection) {
|
|
if (comparator == null) {
|
|
return ImmutableSet.copyOf(collection);
|
|
}
|
|
return ImmutableSortedSet.copyOf(comparator, collection);
|
|
}
|
|
|
|
public static ImmutableSet emptySet(Comparator comparator) {
|
|
if (comparator == null) {
|
|
return ImmutableSet.of();
|
|
}
|
|
return ImmutableSortedSet.emptySet(comparator);
|
|
}
|
|
|
|
public static ImmutableSet.Builder valuesBuilder(Comparator comparator) {
|
|
if (comparator == null) {
|
|
return new ImmutableSet.Builder();
|
|
}
|
|
return new ImmutableSortedSet.Builder(comparator);
|
|
}
|
|
|
|
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
|
|
objectOutputStream.defaultWriteObject();
|
|
objectOutputStream.writeObject(valueComparator());
|
|
Serialization.writeMultimap(this, objectOutputStream);
|
|
}
|
|
|
|
public Comparator valueComparator() {
|
|
ImmutableSet immutableSet = this.emptySet;
|
|
if (immutableSet instanceof ImmutableSortedSet) {
|
|
return ((ImmutableSortedSet) immutableSet).comparator();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
|
|
objectInputStream.defaultReadObject();
|
|
Comparator comparator = (Comparator) objectInputStream.readObject();
|
|
int readInt = objectInputStream.readInt();
|
|
if (readInt < 0) {
|
|
StringBuilder sb = new StringBuilder(29);
|
|
sb.append("Invalid key count ");
|
|
sb.append(readInt);
|
|
throw new InvalidObjectException(sb.toString());
|
|
}
|
|
ImmutableMap.Builder builder = ImmutableMap.builder();
|
|
int i = 0;
|
|
for (int i2 = 0; i2 < readInt; i2++) {
|
|
Object readObject = objectInputStream.readObject();
|
|
int readInt2 = objectInputStream.readInt();
|
|
if (readInt2 <= 0) {
|
|
StringBuilder sb2 = new StringBuilder(31);
|
|
sb2.append("Invalid value count ");
|
|
sb2.append(readInt2);
|
|
throw new InvalidObjectException(sb2.toString());
|
|
}
|
|
ImmutableSet.Builder valuesBuilder = valuesBuilder(comparator);
|
|
for (int i3 = 0; i3 < readInt2; i3++) {
|
|
valuesBuilder.add(objectInputStream.readObject());
|
|
}
|
|
ImmutableSet build = valuesBuilder.build();
|
|
if (build.size() != readInt2) {
|
|
String valueOf = String.valueOf(readObject);
|
|
StringBuilder sb3 = new StringBuilder(valueOf.length() + 40);
|
|
sb3.append("Duplicate key-value pairs exist for key ");
|
|
sb3.append(valueOf);
|
|
throw new InvalidObjectException(sb3.toString());
|
|
}
|
|
builder.put(readObject, build);
|
|
i += readInt2;
|
|
}
|
|
try {
|
|
ImmutableMultimap.FieldSettersHolder.MAP_FIELD_SETTER.set(this, builder.buildOrThrow());
|
|
ImmutableMultimap.FieldSettersHolder.SIZE_FIELD_SETTER.set(this, i);
|
|
SetFieldSettersHolder.EMPTY_SET_FIELD_SETTER.set(this, emptySet(comparator));
|
|
} catch (IllegalArgumentException e) {
|
|
throw ((InvalidObjectException) new InvalidObjectException(e.getMessage()).initCause(e));
|
|
}
|
|
}
|
|
}
|