Rabbit-R1/original r1/java/sources/kotlin/collections/builders/SetBuilder.java
2024-05-21 17:08:36 -04:00

119 lines
7 KiB
Java

package kotlin.collections.builders;
import androidx.exifinterface.media.ExifInterface;
import io.sentry.protocol.OperatingSystem;
import java.io.NotSerializableException;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;
import kotlin.Metadata;
import kotlin.collections.AbstractMutableSet;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.markers.KMutableSet;
/* compiled from: SetBuilder.kt */
@Metadata(d1 = {"\u0000V\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010#\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0010\u001e\n\u0000\n\u0002\u0010\"\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010)\n\u0002\b\u0004\n\u0002\u0010\u0000\n\u0002\b\u0002\b\u0000\u0018\u0000 $*\u0004\b\u0000\u0010\u00012\b\u0012\u0004\u0012\u0002H\u00010\u00022\b\u0012\u0004\u0012\u0002H\u00010\u00032\u00060\u0004j\u0002`\u0005:\u0001$B\u0007\b\u0016¢\u0006\u0002\u0010\u0006B\u000f\b\u0016\u0012\u0006\u0010\u0007\u001a\u00020\\u0006\u0002\u0010\tB\u0019\b\u0000\u0012\u0010\u0010\n\u001a\f\u0012\u0004\u0012\u00028\u0000\u0012\u0002\b\u00030\u000b¢\u0006\u0002\u0010\fJ\u0015\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u0013J\u0016\u0010\u0014\u001a\u00020\u00112\f\u0010\u0015\u001a\b\u0012\u0004\u0012\u00028\u00000\u0016H\u0016J\f\u0010\u0017\u001a\b\u0012\u0004\u0012\u00028\u00000\u0018J\b\u0010\u0019\u001a\u00020\u001aH\u0016J\u0016\u0010\u001b\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00028\u0000H\u0096\u0002¢\u0006\u0002\u0010\u0013J\b\u0010\u001c\u001a\u00020\u0011H\u0016J\u000f\u0010\u001d\u001a\b\u0012\u0004\u0012\u00028\u00000\u001eH\u0096\u0002J\u0015\u0010\u001f\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u0013J\u0016\u0010 \u001a\u00020\u00112\f\u0010\u0015\u001a\b\u0012\u0004\u0012\u00028\u00000\u0016H\u0016J\u0016\u0010!\u001a\u00020\u00112\f\u0010\u0015\u001a\b\u0012\u0004\u0012\u00028\u00000\u0016H\u0016J\b\u0010\"\u001a\u00020#H\u0002R\u0018\u0010\n\u001a\f\u0012\u0004\u0012\u00028\u0000\u0012\u0002\b\u00030\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\r\u001a\u00020\b8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000e\u0010\u000f¨\u0006%"}, d2 = {"Lkotlin/collections/builders/SetBuilder;", ExifInterface.LONGITUDE_EAST, "", "Lkotlin/collections/AbstractMutableSet;", "Ljava/io/Serializable;", "Lkotlin/io/Serializable;", "()V", "initialCapacity", "", "(I)V", "backing", "Lkotlin/collections/builders/MapBuilder;", "(Lkotlin/collections/builders/MapBuilder;)V", "size", "getSize", "()I", "add", "", "element", "(Ljava/lang/Object;)Z", "addAll", "elements", "", OperatingSystem.JsonKeys.BUILD, "", "clear", "", "contains", "isEmpty", "iterator", "", "remove", "removeAll", "retainAll", "writeReplace", "", "Companion", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class SetBuilder<E> extends AbstractMutableSet<E> implements Set<E>, Serializable, KMutableSet {
private static final Companion Companion = new Companion(null);
private static final SetBuilder Empty = new SetBuilder(MapBuilder.INSTANCE.getEmpty$kotlin_stdlib());
private final MapBuilder<E, ?> backing;
/* compiled from: SetBuilder.kt */
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0001\n\u0000\b\u0082\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0006"}, d2 = {"Lkotlin/collections/builders/SetBuilder$Companion;", "", "()V", "Empty", "Lkotlin/collections/builders/SetBuilder;", "", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
private static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
public SetBuilder(MapBuilder<E, ?> backing) {
Intrinsics.checkNotNullParameter(backing, "backing");
this.backing = backing;
}
public SetBuilder() {
this(new MapBuilder());
}
public SetBuilder(int i) {
this(new MapBuilder(i));
}
public final Set<E> build() {
this.backing.build();
if (size() <= 0) {
this = Empty;
}
return this;
}
private final Object writeReplace() {
if (this.backing.getIsReadOnly()) {
return new SerializedCollection(this, 1);
}
throw new NotSerializableException("The set cannot be serialized while it is being built.");
}
@Override // kotlin.collections.AbstractMutableSet
public int getSize() {
return this.backing.size();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean isEmpty() {
return this.backing.isEmpty();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object element) {
return this.backing.containsKey(element);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
this.backing.clear();
}
@Override // kotlin.collections.AbstractMutableSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean add(E element) {
return this.backing.addKey$kotlin_stdlib(element) >= 0;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object element) {
return this.backing.removeKey$kotlin_stdlib(element) >= 0;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<E> iterator() {
return this.backing.keysIterator$kotlin_stdlib();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean addAll(Collection<? extends E> elements) {
Intrinsics.checkNotNullParameter(elements, "elements");
this.backing.checkIsMutable$kotlin_stdlib();
return super.addAll(elements);
}
@Override // java.util.AbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean removeAll(Collection<? extends Object> elements) {
Intrinsics.checkNotNullParameter(elements, "elements");
this.backing.checkIsMutable$kotlin_stdlib();
return super.removeAll(elements);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean retainAll(Collection<? extends Object> elements) {
Intrinsics.checkNotNullParameter(elements, "elements");
this.backing.checkIsMutable$kotlin_stdlib();
return super.retainAll(elements);
}
}