Rabbit-R1/android (non root)/java/sources/kotlin/sequences/DistinctIterator.java
2024-05-21 17:08:36 -04:00

40 lines
2.6 KiB
Java

package kotlin.sequences;
import androidx.exifinterface.media.ExifInterface;
import io.sentry.protocol.TransactionInfo;
import java.util.HashSet;
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.collections.AbstractIterator;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: Sequences.kt */
@Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010(\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\b\u0002\u0018\u0000*\u0004\b\u0000\u0010\u0001*\u0004\b\u0001\u0010\u00022\b\u0012\u0004\u0012\u0002H\u00010\u0003B'\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u0005\u0012\u0012\u0010\u0006\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00028\u00010\u0007¢\u0006\u0002\u0010\bJ\b\u0010\f\u001a\u00020\rH\u0014R\u001a\u0010\u0006\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00028\u00010\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u001e\u0010\t\u001a\u0012\u0012\u0004\u0012\u00028\u00010\nj\b\u0012\u0004\u0012\u00028\u0001`\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00000\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000e"}, d2 = {"Lkotlin/sequences/DistinctIterator;", ExifInterface.GPS_DIRECTION_TRUE, "K", "Lkotlin/collections/AbstractIterator;", TransactionInfo.JsonKeys.SOURCE, "", "keySelector", "Lkotlin/Function1;", "(Ljava/util/Iterator;Lkotlin/jvm/functions/Function1;)V", "observed", "Ljava/util/HashSet;", "Lkotlin/collections/HashSet;", "computeNext", "", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
final class DistinctIterator<T, K> extends AbstractIterator<T> {
private final Function1<T, K> keySelector;
private final HashSet<K> observed;
private final Iterator<T> source;
/* JADX WARN: Multi-variable type inference failed */
public DistinctIterator(Iterator<? extends T> source, Function1<? super T, ? extends K> keySelector) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
this.source = source;
this.keySelector = keySelector;
this.observed = new HashSet<>();
}
@Override // kotlin.collections.AbstractIterator
protected void computeNext() {
while (this.source.hasNext()) {
T next = this.source.next();
if (this.observed.add(this.keySelector.invoke(next))) {
setNext(next);
return;
}
}
done();
}
}