mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
2568 lines
163 KiB
Java
2568 lines
163 KiB
Java
|
package kotlin.sequences;
|
||
|
|
||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||
|
import androidx.exifinterface.media.ExifInterface;
|
||
|
import androidx.media3.exoplayer.upstream.CmcdHeadersFactory;
|
||
|
import io.sentry.protocol.MetricSummary;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Collection;
|
||
|
import java.util.Comparator;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.LinkedHashMap;
|
||
|
import java.util.LinkedHashSet;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
import java.util.NoSuchElementException;
|
||
|
import java.util.Set;
|
||
|
import kotlin.Deprecated;
|
||
|
import kotlin.DeprecatedSinceKotlin;
|
||
|
import kotlin.Metadata;
|
||
|
import kotlin.Pair;
|
||
|
import kotlin.ReplaceWith;
|
||
|
import kotlin.TuplesKt;
|
||
|
import kotlin.UInt;
|
||
|
import kotlin.ULong;
|
||
|
import kotlin.Unit;
|
||
|
import kotlin.collections.ArraysKt;
|
||
|
import kotlin.collections.CollectionsKt;
|
||
|
import kotlin.collections.Grouping;
|
||
|
import kotlin.collections.IndexedValue;
|
||
|
import kotlin.collections.SetsKt;
|
||
|
import kotlin.collections.SlidingWindowKt;
|
||
|
import kotlin.comparisons.ComparisonsKt;
|
||
|
import kotlin.comparisons.ComparisonsKt__ComparisonsKt$compareBy$2;
|
||
|
import kotlin.comparisons.ComparisonsKt__ComparisonsKt$compareByDescending$1;
|
||
|
import kotlin.internal.PlatformImplementationsKt;
|
||
|
import kotlin.jvm.functions.Function1;
|
||
|
import kotlin.jvm.functions.Function2;
|
||
|
import kotlin.jvm.functions.Function3;
|
||
|
import kotlin.jvm.internal.Intrinsics;
|
||
|
import kotlin.jvm.internal.Ref;
|
||
|
import kotlin.text.StringsKt;
|
||
|
import tech.rabbit.r1launcher.BuildConfig;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* compiled from: _Sequences.kt */
|
||
|
@Metadata(d1 = {"\u0000\u0098\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u001c\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010%\n\u0002\b\b\n\u0002\u0010\u0006\n\u0002\u0010\u0005\n\u0002\b\u0002\n\u0002\u0010\u0007\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\n\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u001f\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0000\n\u0002\b\u001c\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0010!\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\r\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0002\b\f\n\u0002\u0010\u000f\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0019\n\u0002\u0010\u0011\n\u0002\b)\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010#\n\u0000\n\u0002\u0010\"\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\u001a0\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u0002H\u00020\u00032\u0012\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u00020\u00010\u0005H\u0086\bø\u0001\u0000\u001a\u0016\u0010\u0006\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u0002H\u00020\u0003\u001a0\u0010\u0006\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u0002H\u00020\u00032\u0012\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u00020\u00010\u0005H\u0086\bø\u0001\u0000\u001a\u001c\u0010\u0007\u001a\b\u0012\u0004\u0012\u0002H\u00020\b\"\u0004\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u0002H\u00020\u0003\u001a\u001f\u0010\t\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0003\"\u0004\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u0002H\u00020\u0003H\u0087\b\u001aT\u0010\n\u001a\u000e\u0012\u0004\u0012\u0002H\f\u0012\u0004\u0012\u0002H\r0\u000b\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\f\"\u0004\b\u0002\u0010\r*\b\u0012\u0004\u0012\u0002H\u00020\u00032\u001e\u0010\u000e\u001a\u001a\u0012\u0004\u0012\u0002H\u0002\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u0002H\f\u0012\u0004\u0012\u0002H\r0\u000f0\u0005H\u0086\bø\u0001\u0000\u001aB\u0010\u0010\u001a\u000e\u0012\u0004\u0012\u0002H\f\u0012\u0004\u0012\u0002H\u00020\u000b\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\f*\b\u0012\u0004\u0012\u0002H\u00020\u00032\u0012\u0010\u0011\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\f0\u0005H\u0086\bø\u0001\u0000\u001a\\\u0010\u0010\u001a\u000e\u0012\u0004\u0012\u0002H\f\u0012\u0004\u0012\u0002H\r0\u000b\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\f\"\u0004\b\u0002\u0010\r*\b\u0012\u0004\u0012\u0002H\u00020\u00032\u0012\u0010\u0011\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\f0\u00052\u0012\u0010\u0012\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\r0\u0005H\u0086\bø\u0001\u0000\u001a]\u0010\u0013\u001a\u0002H\u0014\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\f\"\u0018\b\u0002\u0010\u0014*\u0012\u0012\u0006\b\u0000\u0012\u0002H\f\u0012\u0006\b\u0000\u0012\u0002H\u00020\u0015*\b\u0012\u0004\u0012\u0002H\u00020\u00032\u0006\u0010\u0016\u001a\u0002H\u00142\u0012\u0010\u0011\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\f0\u0005H\u0086\bø\u0001\u0000¢\u0006\u0002\u0010\u0017\u001aw\u0010\u0013\u001a\u0002H\u0014\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\f\"\u0004\b\u0002\u0010\r\"\u0018\b\u0003\u0010\u0014*\u0012\u0012\u0006\b\u0000\u0012\u0002H\f\u0012\u0006\b\u0000\u0012\u0002H\r0\u0015*\b\u0012\u0004\u0012\u0002H\u00020\u00032\u0006\u0010\u0016\u001a\u0002H\u00142\u0012\u0010\u0011\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\f0\u00052\u0012\u0010\u0012\u001a\u000e\u0012\u0004\u0012
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class SequencesKt___SequencesKt extends SequencesKt___SequencesJvmKt {
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
private static final <T> Sequence<T> asSequence(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return sequence;
|
||
|
}
|
||
|
|
||
|
public static final <T> boolean contains(Sequence<? extends T> sequence, T t) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SequencesKt.indexOf(sequence, t) >= 0;
|
||
|
}
|
||
|
|
||
|
public static final <T> T elementAt(Sequence<? extends T> sequence, final int i) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return (T) SequencesKt.elementAtOrElse(sequence, i, new Function1<Integer, T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$elementAt$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
{
|
||
|
super(1);
|
||
|
}
|
||
|
|
||
|
public final T invoke(int i2) {
|
||
|
throw new IndexOutOfBoundsException("Sequence doesn't contain element at index " + i + '.');
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Object invoke(Integer num) {
|
||
|
return invoke(num.intValue());
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public static final <T> T elementAtOrElse(Sequence<? extends T> sequence, int i, Function1<? super Integer, ? extends T> defaultValue) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(defaultValue, "defaultValue");
|
||
|
if (i < 0) {
|
||
|
return defaultValue.invoke(Integer.valueOf(i));
|
||
|
}
|
||
|
int i2 = 0;
|
||
|
for (T t : sequence) {
|
||
|
int i3 = i2 + 1;
|
||
|
if (i == i2) {
|
||
|
return t;
|
||
|
}
|
||
|
i2 = i3;
|
||
|
}
|
||
|
return defaultValue.invoke(Integer.valueOf(i));
|
||
|
}
|
||
|
|
||
|
public static final <T> T elementAtOrNull(Sequence<? extends T> sequence, int i) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
if (i < 0) {
|
||
|
return null;
|
||
|
}
|
||
|
int i2 = 0;
|
||
|
for (T t : sequence) {
|
||
|
int i3 = i2 + 1;
|
||
|
if (i == i2) {
|
||
|
return t;
|
||
|
}
|
||
|
i2 = i3;
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public static final <T> T first(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException("Sequence is empty.");
|
||
|
}
|
||
|
return it.next();
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Type inference failed for: r0v3, types: [T, java.lang.Object] */
|
||
|
public static final <T> T first(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
for (T t : sequence) {
|
||
|
if (predicate.invoke(t).booleanValue()) {
|
||
|
return t;
|
||
|
}
|
||
|
}
|
||
|
throw new NoSuchElementException("Sequence contains no element matching the predicate.");
|
||
|
}
|
||
|
|
||
|
private static final <T, R> R firstNotNullOf(Sequence<? extends T> sequence, Function1<? super T, ? extends R> transform) {
|
||
|
R r;
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (true) {
|
||
|
if (!it.hasNext()) {
|
||
|
r = null;
|
||
|
break;
|
||
|
}
|
||
|
r = transform.invoke(it.next());
|
||
|
if (r != null) {
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
if (r != null) {
|
||
|
return r;
|
||
|
}
|
||
|
throw new NoSuchElementException("No element of the sequence was transformed to a non-null value.");
|
||
|
}
|
||
|
|
||
|
private static final <T, R> R firstNotNullOfOrNull(Sequence<? extends T> sequence, Function1<? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
R invoke = transform.invoke(it.next());
|
||
|
if (invoke != null) {
|
||
|
return invoke;
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public static final <T> T firstOrNull(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (it.hasNext()) {
|
||
|
return it.next();
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Type inference failed for: r0v3, types: [T, java.lang.Object] */
|
||
|
public static final <T> T firstOrNull(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
for (T t : sequence) {
|
||
|
if (predicate.invoke(t).booleanValue()) {
|
||
|
return t;
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public static final <T> int indexOf(Sequence<? extends T> sequence, T t) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
int i = 0;
|
||
|
for (T t2 : sequence) {
|
||
|
if (i < 0) {
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
if (Intrinsics.areEqual(t, t2)) {
|
||
|
return i;
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
public static final <T> int indexOfFirst(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
int i = 0;
|
||
|
for (T t : sequence) {
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
if (predicate.invoke(t).booleanValue()) {
|
||
|
return i;
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
public static final <T> int indexOfLast(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
int i = -1;
|
||
|
int i2 = 0;
|
||
|
for (T t : sequence) {
|
||
|
if (i2 < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
if (predicate.invoke(t).booleanValue()) {
|
||
|
i = i2;
|
||
|
}
|
||
|
i2++;
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
public static final <T> T last(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException("Sequence is empty.");
|
||
|
}
|
||
|
T next = it.next();
|
||
|
while (it.hasNext()) {
|
||
|
next = it.next();
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
/* JADX WARN: Type inference failed for: r2v1, types: [java.lang.Object] */
|
||
|
public static final <T> T last(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
T t = null;
|
||
|
boolean z = false;
|
||
|
for (T t2 : sequence) {
|
||
|
if (predicate.invoke(t2).booleanValue()) {
|
||
|
z = true;
|
||
|
t = t2;
|
||
|
}
|
||
|
}
|
||
|
if (z) {
|
||
|
return t;
|
||
|
}
|
||
|
throw new NoSuchElementException("Sequence contains no element matching the predicate.");
|
||
|
}
|
||
|
|
||
|
public static final <T> int lastIndexOf(Sequence<? extends T> sequence, T t) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
int i = -1;
|
||
|
int i2 = 0;
|
||
|
for (T t2 : sequence) {
|
||
|
if (i2 < 0) {
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
if (Intrinsics.areEqual(t, t2)) {
|
||
|
i = i2;
|
||
|
}
|
||
|
i2++;
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
public static final <T> T lastOrNull(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
T next = it.next();
|
||
|
while (it.hasNext()) {
|
||
|
next = it.next();
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
/* JADX WARN: Type inference failed for: r1v1, types: [java.lang.Object] */
|
||
|
public static final <T> T lastOrNull(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
T t = null;
|
||
|
for (T t2 : sequence) {
|
||
|
if (predicate.invoke(t2).booleanValue()) {
|
||
|
t = t2;
|
||
|
}
|
||
|
}
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
public static final <T> T single(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException("Sequence is empty.");
|
||
|
}
|
||
|
T next = it.next();
|
||
|
if (it.hasNext()) {
|
||
|
throw new IllegalArgumentException("Sequence has more than one element.");
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
/* JADX WARN: Type inference failed for: r2v1, types: [java.lang.Object] */
|
||
|
public static final <T> T single(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
T t = null;
|
||
|
boolean z = false;
|
||
|
for (T t2 : sequence) {
|
||
|
if (predicate.invoke(t2).booleanValue()) {
|
||
|
if (z) {
|
||
|
throw new IllegalArgumentException("Sequence contains more than one matching element.");
|
||
|
}
|
||
|
z = true;
|
||
|
t = t2;
|
||
|
}
|
||
|
}
|
||
|
if (z) {
|
||
|
return t;
|
||
|
}
|
||
|
throw new NoSuchElementException("Sequence contains no element matching the predicate.");
|
||
|
}
|
||
|
|
||
|
public static final <T> T singleOrNull(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
T next = it.next();
|
||
|
if (it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
/* JADX WARN: Type inference failed for: r3v1, types: [java.lang.Object] */
|
||
|
public static final <T> T singleOrNull(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
boolean z = false;
|
||
|
T t = null;
|
||
|
for (T t2 : sequence) {
|
||
|
if (predicate.invoke(t2).booleanValue()) {
|
||
|
if (z) {
|
||
|
return null;
|
||
|
}
|
||
|
z = true;
|
||
|
t = t2;
|
||
|
}
|
||
|
}
|
||
|
if (z) {
|
||
|
return t;
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static final <T> Sequence<T> drop(Sequence<? extends T> sequence, int i) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
if (i >= 0) {
|
||
|
return i == 0 ? sequence : sequence instanceof DropTakeSequence ? ((DropTakeSequence) sequence).drop(i) : new DropSequence(sequence, i);
|
||
|
}
|
||
|
throw new IllegalArgumentException(("Requested element count " + i + " is less than zero.").toString());
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> dropWhile(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
return new DropWhileSequence(sequence, predicate);
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> filter(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
return new FilteringSequence(sequence, true, predicate);
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> filterIndexed(Sequence<? extends T> sequence, final Function2<? super Integer, ? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
return new TransformingSequence(new FilteringSequence(new IndexingSequence(sequence), true, new Function1<IndexedValue<? extends T>, Boolean>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$filterIndexed$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
{
|
||
|
super(1);
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final Boolean invoke(IndexedValue<? extends T> it) {
|
||
|
Intrinsics.checkNotNullParameter(it, "it");
|
||
|
return predicate.invoke(Integer.valueOf(it.getIndex()), it.getValue());
|
||
|
}
|
||
|
}), new Function1<IndexedValue<? extends T>, T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$filterIndexed$2
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final T invoke(IndexedValue<? extends T> it) {
|
||
|
Intrinsics.checkNotNullParameter(it, "it");
|
||
|
return it.getValue();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ <R> Sequence<R> filterIsInstance(Sequence<?> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.needClassReification();
|
||
|
Sequence<R> filter = SequencesKt.filter(sequence, new Function1<Object, Boolean>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$filterIsInstance$1
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final Boolean invoke(Object obj) {
|
||
|
Intrinsics.reifiedOperationMarker(3, "R");
|
||
|
return Boolean.valueOf(obj instanceof Object);
|
||
|
}
|
||
|
});
|
||
|
Intrinsics.checkNotNull(filter, "null cannot be cast to non-null type kotlin.sequences.Sequence<R of kotlin.sequences.SequencesKt___SequencesKt.filterIsInstance>");
|
||
|
return filter;
|
||
|
}
|
||
|
|
||
|
public static final /* synthetic */ <R, C extends Collection<? super R>> C filterIsInstanceTo(Sequence<?> sequence, C destination) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
for (Object obj : sequence) {
|
||
|
Intrinsics.reifiedOperationMarker(3, "R");
|
||
|
if (obj instanceof Object) {
|
||
|
destination.add(obj);
|
||
|
}
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> filterNot(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
return new FilteringSequence(sequence, false, predicate);
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> filterNotNull(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Sequence<T> filterNot = SequencesKt.filterNot(sequence, new Function1<T, Boolean>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$filterNotNull$1
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final Boolean invoke(T t) {
|
||
|
return Boolean.valueOf(t == null);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Boolean invoke(Object obj) {
|
||
|
return invoke((SequencesKt___SequencesKt$filterNotNull$1<T>) obj);
|
||
|
}
|
||
|
});
|
||
|
Intrinsics.checkNotNull(filterNot, "null cannot be cast to non-null type kotlin.sequences.Sequence<T of kotlin.sequences.SequencesKt___SequencesKt.filterNotNull>");
|
||
|
return filterNot;
|
||
|
}
|
||
|
|
||
|
public static final <C extends Collection<? super T>, T> C filterNotNullTo(Sequence<? extends T> sequence, C destination) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
for (T t : sequence) {
|
||
|
if (t != null) {
|
||
|
destination.add(t);
|
||
|
}
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, C extends Collection<? super T>> C filterNotTo(Sequence<? extends T> sequence, C destination, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
for (T t : sequence) {
|
||
|
if (!predicate.invoke(t).booleanValue()) {
|
||
|
destination.add(t);
|
||
|
}
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, C extends Collection<? super T>> C filterTo(Sequence<? extends T> sequence, C destination, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
for (T t : sequence) {
|
||
|
if (predicate.invoke(t).booleanValue()) {
|
||
|
destination.add(t);
|
||
|
}
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> take(Sequence<? extends T> sequence, int i) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
if (i < 0) {
|
||
|
throw new IllegalArgumentException(("Requested element count " + i + " is less than zero.").toString());
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
return SequencesKt.emptySequence();
|
||
|
}
|
||
|
return sequence instanceof DropTakeSequence ? ((DropTakeSequence) sequence).take(i) : new TakeSequence(sequence, i);
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> takeWhile(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
return new TakeWhileSequence(sequence, predicate);
|
||
|
}
|
||
|
|
||
|
public static final <T extends Comparable<? super T>> Sequence<T> sorted(final Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return (Sequence) new Sequence<T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$sorted$1
|
||
|
@Override // kotlin.sequences.Sequence
|
||
|
public Iterator<T> iterator() {
|
||
|
List mutableList = SequencesKt.toMutableList(sequence);
|
||
|
CollectionsKt.sort(mutableList);
|
||
|
return mutableList.iterator();
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
public static final <T, R extends Comparable<? super R>> Sequence<T> sortedBy(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
return SequencesKt.sortedWith(sequence, new ComparisonsKt__ComparisonsKt$compareBy$2(selector));
|
||
|
}
|
||
|
|
||
|
public static final <T, R extends Comparable<? super R>> Sequence<T> sortedByDescending(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
return SequencesKt.sortedWith(sequence, new ComparisonsKt__ComparisonsKt$compareByDescending$1(selector));
|
||
|
}
|
||
|
|
||
|
public static final <T extends Comparable<? super T>> Sequence<T> sortedDescending(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SequencesKt.sortedWith(sequence, ComparisonsKt.reverseOrder());
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> sortedWith(final Sequence<? extends T> sequence, final Comparator<? super T> comparator) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(comparator, "comparator");
|
||
|
return new Sequence<T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$sortedWith$1
|
||
|
@Override // kotlin.sequences.Sequence
|
||
|
public Iterator<T> iterator() {
|
||
|
List mutableList = SequencesKt.toMutableList(sequence);
|
||
|
CollectionsKt.sortWith(mutableList, comparator);
|
||
|
return mutableList.iterator();
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
public static final <T, K, V> Map<K, V> associate(Sequence<? extends T> sequence, Function1<? super T, ? extends Pair<? extends K, ? extends V>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
Pair<? extends K, ? extends V> invoke = transform.invoke(it.next());
|
||
|
linkedHashMap.put(invoke.getFirst(), invoke.getSecond());
|
||
|
}
|
||
|
return linkedHashMap;
|
||
|
}
|
||
|
|
||
|
public static final <T, K> Map<K, T> associateBy(Sequence<? extends T> sequence, Function1<? super T, ? extends K> keySelector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
|
||
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
||
|
for (T t : sequence) {
|
||
|
linkedHashMap.put(keySelector.invoke(t), t);
|
||
|
}
|
||
|
return linkedHashMap;
|
||
|
}
|
||
|
|
||
|
public static final <T, K, V> Map<K, V> associateBy(Sequence<? extends T> sequence, Function1<? super T, ? extends K> keySelector, Function1<? super T, ? extends V> valueTransform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
|
||
|
Intrinsics.checkNotNullParameter(valueTransform, "valueTransform");
|
||
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
||
|
for (T t : sequence) {
|
||
|
linkedHashMap.put(keySelector.invoke(t), valueTransform.invoke(t));
|
||
|
}
|
||
|
return linkedHashMap;
|
||
|
}
|
||
|
|
||
|
public static final <T, K, M extends Map<? super K, ? super T>> M associateByTo(Sequence<? extends T> sequence, M destination, Function1<? super T, ? extends K> keySelector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
|
||
|
for (T t : sequence) {
|
||
|
destination.put(keySelector.invoke(t), t);
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, K, V, M extends Map<? super K, ? super V>> M associateByTo(Sequence<? extends T> sequence, M destination, Function1<? super T, ? extends K> keySelector, Function1<? super T, ? extends V> valueTransform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
|
||
|
Intrinsics.checkNotNullParameter(valueTransform, "valueTransform");
|
||
|
for (T t : sequence) {
|
||
|
destination.put(keySelector.invoke(t), valueTransform.invoke(t));
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, K, V, M extends Map<? super K, ? super V>> M associateTo(Sequence<? extends T> sequence, M destination, Function1<? super T, ? extends Pair<? extends K, ? extends V>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
Pair<? extends K, ? extends V> invoke = transform.invoke(it.next());
|
||
|
destination.put(invoke.getFirst(), invoke.getSecond());
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <K, V> Map<K, V> associateWith(Sequence<? extends K> sequence, Function1<? super K, ? extends V> valueSelector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(valueSelector, "valueSelector");
|
||
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
||
|
for (K k : sequence) {
|
||
|
linkedHashMap.put(k, valueSelector.invoke(k));
|
||
|
}
|
||
|
return linkedHashMap;
|
||
|
}
|
||
|
|
||
|
public static final <K, V, M extends Map<? super K, ? super V>> M associateWithTo(Sequence<? extends K> sequence, M destination, Function1<? super K, ? extends V> valueSelector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(valueSelector, "valueSelector");
|
||
|
for (K k : sequence) {
|
||
|
destination.put(k, valueSelector.invoke(k));
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, C extends Collection<? super T>> C toCollection(Sequence<? extends T> sequence, C destination) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
destination.add(it.next());
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T> HashSet<T> toHashSet(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return (HashSet) SequencesKt.toCollection(sequence, new HashSet());
|
||
|
}
|
||
|
|
||
|
public static final <T> List<T> toList(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return CollectionsKt.emptyList();
|
||
|
}
|
||
|
T next = it.next();
|
||
|
if (!it.hasNext()) {
|
||
|
return CollectionsKt.listOf(next);
|
||
|
}
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
arrayList.add(next);
|
||
|
while (it.hasNext()) {
|
||
|
arrayList.add(it.next());
|
||
|
}
|
||
|
return arrayList;
|
||
|
}
|
||
|
|
||
|
public static final <T> List<T> toMutableList(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return (List) SequencesKt.toCollection(sequence, new ArrayList());
|
||
|
}
|
||
|
|
||
|
public static final <T> Set<T> toSet(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return SetsKt.emptySet();
|
||
|
}
|
||
|
T next = it.next();
|
||
|
if (!it.hasNext()) {
|
||
|
return SetsKt.setOf(next);
|
||
|
}
|
||
|
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
||
|
linkedHashSet.add(next);
|
||
|
while (it.hasNext()) {
|
||
|
linkedHashSet.add(it.next());
|
||
|
}
|
||
|
return linkedHashSet;
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> flatMapIterable(Sequence<? extends T> sequence, Function1<? super T, ? extends Iterable<? extends R>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return new FlatteningSequence(sequence, transform, SequencesKt___SequencesKt$flatMap$1.INSTANCE);
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> flatMap(Sequence<? extends T> sequence, Function1<? super T, ? extends Sequence<? extends R>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return new FlatteningSequence(sequence, transform, SequencesKt___SequencesKt$flatMap$2.INSTANCE);
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> flatMapIndexedIterable(Sequence<? extends T> sequence, Function2<? super Integer, ? super T, ? extends Iterable<? extends R>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return SequencesKt.flatMapIndexed(sequence, transform, SequencesKt___SequencesKt$flatMapIndexed$1.INSTANCE);
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> flatMapIndexedSequence(Sequence<? extends T> sequence, Function2<? super Integer, ? super T, ? extends Sequence<? extends R>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return SequencesKt.flatMapIndexed(sequence, transform, SequencesKt___SequencesKt$flatMapIndexed$2.INSTANCE);
|
||
|
}
|
||
|
|
||
|
private static final <T, R, C extends Collection<? super R>> C flatMapIndexedIterableTo(Sequence<? extends T> sequence, C destination, Function2<? super Integer, ? super T, ? extends Iterable<? extends R>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
int i = 0;
|
||
|
for (T t : sequence) {
|
||
|
int i2 = i + 1;
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
CollectionsKt.addAll(destination, transform.invoke(Integer.valueOf(i), t));
|
||
|
i = i2;
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
private static final <T, R, C extends Collection<? super R>> C flatMapIndexedSequenceTo(Sequence<? extends T> sequence, C destination, Function2<? super Integer, ? super T, ? extends Sequence<? extends R>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
int i = 0;
|
||
|
for (T t : sequence) {
|
||
|
int i2 = i + 1;
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
CollectionsKt.addAll(destination, transform.invoke(Integer.valueOf(i), t));
|
||
|
i = i2;
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, R, C extends Collection<? super R>> C flatMapIterableTo(Sequence<? extends T> sequence, C destination, Function1<? super T, ? extends Iterable<? extends R>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
CollectionsKt.addAll(destination, transform.invoke(it.next()));
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, R, C extends Collection<? super R>> C flatMapTo(Sequence<? extends T> sequence, C destination, Function1<? super T, ? extends Sequence<? extends R>> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
CollectionsKt.addAll(destination, transform.invoke(it.next()));
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, K> Map<K, List<T>> groupBy(Sequence<? extends T> sequence, Function1<? super T, ? extends K> keySelector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
|
||
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
||
|
for (T t : sequence) {
|
||
|
K invoke = keySelector.invoke(t);
|
||
|
Object obj = linkedHashMap.get(invoke);
|
||
|
if (obj == null) {
|
||
|
obj = (List) new ArrayList();
|
||
|
linkedHashMap.put(invoke, obj);
|
||
|
}
|
||
|
((List) obj).add(t);
|
||
|
}
|
||
|
return linkedHashMap;
|
||
|
}
|
||
|
|
||
|
public static final <T, K, V> Map<K, List<V>> groupBy(Sequence<? extends T> sequence, Function1<? super T, ? extends K> keySelector, Function1<? super T, ? extends V> valueTransform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
|
||
|
Intrinsics.checkNotNullParameter(valueTransform, "valueTransform");
|
||
|
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
||
|
for (T t : sequence) {
|
||
|
K invoke = keySelector.invoke(t);
|
||
|
ArrayList arrayList = linkedHashMap.get(invoke);
|
||
|
if (arrayList == null) {
|
||
|
arrayList = new ArrayList();
|
||
|
linkedHashMap.put(invoke, arrayList);
|
||
|
}
|
||
|
arrayList.add(valueTransform.invoke(t));
|
||
|
}
|
||
|
return linkedHashMap;
|
||
|
}
|
||
|
|
||
|
public static final <T, K, M extends Map<? super K, List<T>>> M groupByTo(Sequence<? extends T> sequence, M destination, Function1<? super T, ? extends K> keySelector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
|
||
|
for (T t : sequence) {
|
||
|
K invoke = keySelector.invoke(t);
|
||
|
Object obj = destination.get(invoke);
|
||
|
if (obj == null) {
|
||
|
obj = (List) new ArrayList();
|
||
|
destination.put(invoke, obj);
|
||
|
}
|
||
|
((List) obj).add(t);
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static final <T, K, V, M extends Map<? super K, List<V>>> M groupByTo(Sequence<? extends T> sequence, M destination, Function1<? super T, ? extends K> keySelector, Function1<? super T, ? extends V> valueTransform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
|
||
|
Intrinsics.checkNotNullParameter(valueTransform, "valueTransform");
|
||
|
for (T t : sequence) {
|
||
|
K invoke = keySelector.invoke(t);
|
||
|
Object obj = destination.get(invoke);
|
||
|
if (obj == null) {
|
||
|
obj = (List) new ArrayList();
|
||
|
destination.put(invoke, obj);
|
||
|
}
|
||
|
((List) obj).add(valueTransform.invoke(t));
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, K> Grouping<T, K> groupingBy(final Sequence<? extends T> sequence, final Function1<? super T, ? extends K> keySelector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(keySelector, "keySelector");
|
||
|
return new Grouping<T, K>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$groupingBy$1
|
||
|
@Override // kotlin.collections.Grouping
|
||
|
public Iterator<T> sourceIterator() {
|
||
|
return sequence.iterator();
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.collections.Grouping
|
||
|
public K keyOf(T element) {
|
||
|
return keySelector.invoke(element);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> map(Sequence<? extends T> sequence, Function1<? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return new TransformingSequence(sequence, transform);
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> mapIndexed(Sequence<? extends T> sequence, Function2<? super Integer, ? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return new TransformingIndexedSequence(sequence, transform);
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> mapIndexedNotNull(Sequence<? extends T> sequence, Function2<? super Integer, ? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return SequencesKt.filterNotNull(new TransformingIndexedSequence(sequence, transform));
|
||
|
}
|
||
|
|
||
|
public static final <T, R, C extends Collection<? super R>> C mapIndexedTo(Sequence<? extends T> sequence, C destination, Function2<? super Integer, ? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
int i = 0;
|
||
|
for (T t : sequence) {
|
||
|
int i2 = i + 1;
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
destination.add(transform.invoke(Integer.valueOf(i), t));
|
||
|
i = i2;
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> mapNotNull(Sequence<? extends T> sequence, Function1<? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return SequencesKt.filterNotNull(new TransformingSequence(sequence, transform));
|
||
|
}
|
||
|
|
||
|
public static final <T, R, C extends Collection<? super R>> C mapTo(Sequence<? extends T> sequence, C destination, Function1<? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
destination.add(transform.invoke(it.next()));
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<IndexedValue<T>> withIndex(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return new IndexingSequence(sequence);
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> distinct(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SequencesKt.distinctBy(sequence, new Function1<T, T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$distinct$1
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final T invoke(T t) {
|
||
|
return t;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public static final <T, K> Sequence<T> distinctBy(Sequence<? extends T> sequence, Function1<? super T, ? extends K> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
return new DistinctSequence(sequence, selector);
|
||
|
}
|
||
|
|
||
|
public static final <T> Set<T> toMutableSet(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
linkedHashSet.add(it.next());
|
||
|
}
|
||
|
return linkedHashSet;
|
||
|
}
|
||
|
|
||
|
public static final <T> boolean all(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
if (!predicate.invoke(it.next()).booleanValue()) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public static final <T> boolean any(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return sequence.iterator().hasNext();
|
||
|
}
|
||
|
|
||
|
public static final <T> boolean any(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
if (predicate.invoke(it.next()).booleanValue()) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
public static final <T> int count(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
it.next();
|
||
|
i++;
|
||
|
if (i < 0) {
|
||
|
CollectionsKt.throwCountOverflow();
|
||
|
}
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
public static final <T> int count(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
if (predicate.invoke(it.next()).booleanValue() && (i = i + 1) < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Count overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwCountOverflow();
|
||
|
}
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
public static final <T, R> R fold(Sequence<? extends T> sequence, R r, Function2<? super R, ? super T, ? extends R> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
r = operation.invoke(r, it.next());
|
||
|
}
|
||
|
return r;
|
||
|
}
|
||
|
|
||
|
public static final <T, R> R foldIndexed(Sequence<? extends T> sequence, R r, Function3<? super Integer, ? super R, ? super T, ? extends R> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
int i = 0;
|
||
|
for (T t : sequence) {
|
||
|
int i2 = i + 1;
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
r = operation.invoke(Integer.valueOf(i), r, t);
|
||
|
i = i2;
|
||
|
}
|
||
|
return r;
|
||
|
}
|
||
|
|
||
|
public static final <T> void forEach(Sequence<? extends T> sequence, Function1<? super T, Unit> action) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(action, "action");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
action.invoke(it.next());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static final <T> void forEachIndexed(Sequence<? extends T> sequence, Function2<? super Integer, ? super T, Unit> action) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(action, "action");
|
||
|
int i = 0;
|
||
|
for (T t : sequence) {
|
||
|
int i2 = i + 1;
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
action.invoke(Integer.valueOf(i), t);
|
||
|
i = i2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static final double maxOrThrow(Sequence<Double> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Double> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
double doubleValue = it.next().doubleValue();
|
||
|
while (it.hasNext()) {
|
||
|
doubleValue = Math.max(doubleValue, it.next().doubleValue());
|
||
|
}
|
||
|
return doubleValue;
|
||
|
}
|
||
|
|
||
|
/* renamed from: maxOrThrow, reason: collision with other method in class */
|
||
|
public static final float m6980maxOrThrow(Sequence<Float> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Float> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
float floatValue = it.next().floatValue();
|
||
|
while (it.hasNext()) {
|
||
|
floatValue = Math.max(floatValue, it.next().floatValue());
|
||
|
}
|
||
|
return floatValue;
|
||
|
}
|
||
|
|
||
|
/* renamed from: maxOrThrow, reason: collision with other method in class */
|
||
|
public static final <T extends Comparable<? super T>> T m6981maxOrThrow(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
T next = it.next();
|
||
|
while (it.hasNext()) {
|
||
|
T next2 = it.next();
|
||
|
if (next.compareTo(next2) < 0) {
|
||
|
next = next2;
|
||
|
}
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Type inference failed for: r0v10 */
|
||
|
/* JADX WARN: Type inference failed for: r0v11 */
|
||
|
/* JADX WARN: Type inference failed for: r0v3, types: [T, java.lang.Object] */
|
||
|
/* JADX WARN: Type inference failed for: r0v4 */
|
||
|
/* JADX WARN: Type inference failed for: r0v5, types: [T] */
|
||
|
public static final <T, R extends Comparable<? super R>> T maxByOrThrow(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
T next = it.next();
|
||
|
if (!it.hasNext()) {
|
||
|
return next;
|
||
|
}
|
||
|
R invoke = selector.invoke(next);
|
||
|
do {
|
||
|
T next2 = it.next();
|
||
|
R invoke2 = selector.invoke(next2);
|
||
|
next = next;
|
||
|
if (invoke.compareTo(invoke2) < 0) {
|
||
|
invoke = invoke2;
|
||
|
next = next2;
|
||
|
}
|
||
|
} while (it.hasNext());
|
||
|
return (T) next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Type inference failed for: r0v10 */
|
||
|
/* JADX WARN: Type inference failed for: r0v11 */
|
||
|
/* JADX WARN: Type inference failed for: r0v3, types: [T, java.lang.Object] */
|
||
|
/* JADX WARN: Type inference failed for: r0v4 */
|
||
|
/* JADX WARN: Type inference failed for: r0v5, types: [T] */
|
||
|
public static final <T, R extends Comparable<? super R>> T maxByOrNull(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
T next = it.next();
|
||
|
if (!it.hasNext()) {
|
||
|
return next;
|
||
|
}
|
||
|
R invoke = selector.invoke(next);
|
||
|
do {
|
||
|
T next2 = it.next();
|
||
|
R invoke2 = selector.invoke(next2);
|
||
|
next = next;
|
||
|
if (invoke.compareTo(invoke2) < 0) {
|
||
|
invoke = invoke2;
|
||
|
next = next2;
|
||
|
}
|
||
|
} while (it.hasNext());
|
||
|
return (T) next;
|
||
|
}
|
||
|
|
||
|
private static final <T> double maxOf(Sequence<? extends T> sequence, Function1<? super T, Double> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
double doubleValue = selector.invoke(it.next()).doubleValue();
|
||
|
while (it.hasNext()) {
|
||
|
doubleValue = Math.max(doubleValue, selector.invoke(it.next()).doubleValue());
|
||
|
}
|
||
|
return doubleValue;
|
||
|
}
|
||
|
|
||
|
/* renamed from: maxOf, reason: collision with other method in class */
|
||
|
private static final <T> float m6974maxOf(Sequence<? extends T> sequence, Function1<? super T, Float> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
float floatValue = selector.invoke(it.next()).floatValue();
|
||
|
while (it.hasNext()) {
|
||
|
floatValue = Math.max(floatValue, selector.invoke(it.next()).floatValue());
|
||
|
}
|
||
|
return floatValue;
|
||
|
}
|
||
|
|
||
|
/* renamed from: maxOf, reason: collision with other method in class */
|
||
|
private static final <T, R extends Comparable<? super R>> R m6975maxOf(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
R invoke = selector.invoke(it.next());
|
||
|
while (it.hasNext()) {
|
||
|
R invoke2 = selector.invoke(it.next());
|
||
|
if (invoke.compareTo(invoke2) < 0) {
|
||
|
invoke = invoke2;
|
||
|
}
|
||
|
}
|
||
|
return invoke;
|
||
|
}
|
||
|
|
||
|
/* renamed from: maxOfOrNull, reason: collision with other method in class */
|
||
|
private static final <T> Double m6976maxOfOrNull(Sequence<? extends T> sequence, Function1<? super T, Double> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
double doubleValue = selector.invoke(it.next()).doubleValue();
|
||
|
while (it.hasNext()) {
|
||
|
doubleValue = Math.max(doubleValue, selector.invoke(it.next()).doubleValue());
|
||
|
}
|
||
|
return Double.valueOf(doubleValue);
|
||
|
}
|
||
|
|
||
|
/* renamed from: maxOfOrNull, reason: collision with other method in class */
|
||
|
private static final <T> Float m6977maxOfOrNull(Sequence<? extends T> sequence, Function1<? super T, Float> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
float floatValue = selector.invoke(it.next()).floatValue();
|
||
|
while (it.hasNext()) {
|
||
|
floatValue = Math.max(floatValue, selector.invoke(it.next()).floatValue());
|
||
|
}
|
||
|
return Float.valueOf(floatValue);
|
||
|
}
|
||
|
|
||
|
private static final <T, R extends Comparable<? super R>> R maxOfOrNull(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
R invoke = selector.invoke(it.next());
|
||
|
while (it.hasNext()) {
|
||
|
R invoke2 = selector.invoke(it.next());
|
||
|
if (invoke.compareTo(invoke2) < 0) {
|
||
|
invoke = invoke2;
|
||
|
}
|
||
|
}
|
||
|
return invoke;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
private static final <T, R> R maxOfWith(Sequence<? extends T> sequence, Comparator<? super R> comparator, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(comparator, "comparator");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
Object obj = (R) selector.invoke((T) it.next());
|
||
|
while (it.hasNext()) {
|
||
|
Object obj2 = (R) selector.invoke((T) it.next());
|
||
|
if (comparator.compare(obj, obj2) < 0) {
|
||
|
obj = (R) obj2;
|
||
|
}
|
||
|
}
|
||
|
return (R) obj;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
private static final <T, R> R maxOfWithOrNull(Sequence<? extends T> sequence, Comparator<? super R> comparator, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(comparator, "comparator");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
Object obj = (R) selector.invoke((T) it.next());
|
||
|
while (it.hasNext()) {
|
||
|
Object obj2 = (R) selector.invoke((T) it.next());
|
||
|
if (comparator.compare(obj, obj2) < 0) {
|
||
|
obj = (R) obj2;
|
||
|
}
|
||
|
}
|
||
|
return (R) obj;
|
||
|
}
|
||
|
|
||
|
/* renamed from: maxOrNull, reason: collision with other method in class */
|
||
|
public static final Double m6978maxOrNull(Sequence<Double> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Double> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
double doubleValue = it.next().doubleValue();
|
||
|
while (it.hasNext()) {
|
||
|
doubleValue = Math.max(doubleValue, it.next().doubleValue());
|
||
|
}
|
||
|
return Double.valueOf(doubleValue);
|
||
|
}
|
||
|
|
||
|
/* renamed from: maxOrNull, reason: collision with other method in class */
|
||
|
public static final Float m6979maxOrNull(Sequence<Float> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Float> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
float floatValue = it.next().floatValue();
|
||
|
while (it.hasNext()) {
|
||
|
floatValue = Math.max(floatValue, it.next().floatValue());
|
||
|
}
|
||
|
return Float.valueOf(floatValue);
|
||
|
}
|
||
|
|
||
|
public static final <T extends Comparable<? super T>> T maxOrNull(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
T next = it.next();
|
||
|
while (it.hasNext()) {
|
||
|
T next2 = it.next();
|
||
|
if (next.compareTo(next2) < 0) {
|
||
|
next = next2;
|
||
|
}
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static final <T> T maxWithOrThrow(Sequence<? extends T> sequence, Comparator<? super T> comparator) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(comparator, "comparator");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
Object obj = (T) it.next();
|
||
|
while (it.hasNext()) {
|
||
|
Object obj2 = (T) it.next();
|
||
|
if (comparator.compare(obj, obj2) < 0) {
|
||
|
obj = (T) obj2;
|
||
|
}
|
||
|
}
|
||
|
return (T) obj;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static final <T> T maxWithOrNull(Sequence<? extends T> sequence, Comparator<? super T> comparator) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(comparator, "comparator");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
Object obj = (T) it.next();
|
||
|
while (it.hasNext()) {
|
||
|
Object obj2 = (T) it.next();
|
||
|
if (comparator.compare(obj, obj2) < 0) {
|
||
|
obj = (T) obj2;
|
||
|
}
|
||
|
}
|
||
|
return (T) obj;
|
||
|
}
|
||
|
|
||
|
public static final double minOrThrow(Sequence<Double> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Double> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
double doubleValue = it.next().doubleValue();
|
||
|
while (it.hasNext()) {
|
||
|
doubleValue = Math.min(doubleValue, it.next().doubleValue());
|
||
|
}
|
||
|
return doubleValue;
|
||
|
}
|
||
|
|
||
|
/* renamed from: minOrThrow, reason: collision with other method in class */
|
||
|
public static final float m6988minOrThrow(Sequence<Float> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Float> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
float floatValue = it.next().floatValue();
|
||
|
while (it.hasNext()) {
|
||
|
floatValue = Math.min(floatValue, it.next().floatValue());
|
||
|
}
|
||
|
return floatValue;
|
||
|
}
|
||
|
|
||
|
/* renamed from: minOrThrow, reason: collision with other method in class */
|
||
|
public static final <T extends Comparable<? super T>> T m6989minOrThrow(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
T next = it.next();
|
||
|
while (it.hasNext()) {
|
||
|
T next2 = it.next();
|
||
|
if (next.compareTo(next2) > 0) {
|
||
|
next = next2;
|
||
|
}
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Type inference failed for: r0v10 */
|
||
|
/* JADX WARN: Type inference failed for: r0v11 */
|
||
|
/* JADX WARN: Type inference failed for: r0v3, types: [T, java.lang.Object] */
|
||
|
/* JADX WARN: Type inference failed for: r0v4 */
|
||
|
/* JADX WARN: Type inference failed for: r0v5, types: [T] */
|
||
|
public static final <T, R extends Comparable<? super R>> T minByOrThrow(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
T next = it.next();
|
||
|
if (!it.hasNext()) {
|
||
|
return next;
|
||
|
}
|
||
|
R invoke = selector.invoke(next);
|
||
|
do {
|
||
|
T next2 = it.next();
|
||
|
R invoke2 = selector.invoke(next2);
|
||
|
next = next;
|
||
|
if (invoke.compareTo(invoke2) > 0) {
|
||
|
invoke = invoke2;
|
||
|
next = next2;
|
||
|
}
|
||
|
} while (it.hasNext());
|
||
|
return (T) next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Type inference failed for: r0v10 */
|
||
|
/* JADX WARN: Type inference failed for: r0v11 */
|
||
|
/* JADX WARN: Type inference failed for: r0v3, types: [T, java.lang.Object] */
|
||
|
/* JADX WARN: Type inference failed for: r0v4 */
|
||
|
/* JADX WARN: Type inference failed for: r0v5, types: [T] */
|
||
|
public static final <T, R extends Comparable<? super R>> T minByOrNull(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
T next = it.next();
|
||
|
if (!it.hasNext()) {
|
||
|
return next;
|
||
|
}
|
||
|
R invoke = selector.invoke(next);
|
||
|
do {
|
||
|
T next2 = it.next();
|
||
|
R invoke2 = selector.invoke(next2);
|
||
|
next = next;
|
||
|
if (invoke.compareTo(invoke2) > 0) {
|
||
|
invoke = invoke2;
|
||
|
next = next2;
|
||
|
}
|
||
|
} while (it.hasNext());
|
||
|
return (T) next;
|
||
|
}
|
||
|
|
||
|
private static final <T> double minOf(Sequence<? extends T> sequence, Function1<? super T, Double> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
double doubleValue = selector.invoke(it.next()).doubleValue();
|
||
|
while (it.hasNext()) {
|
||
|
doubleValue = Math.min(doubleValue, selector.invoke(it.next()).doubleValue());
|
||
|
}
|
||
|
return doubleValue;
|
||
|
}
|
||
|
|
||
|
/* renamed from: minOf, reason: collision with other method in class */
|
||
|
private static final <T> float m6982minOf(Sequence<? extends T> sequence, Function1<? super T, Float> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
float floatValue = selector.invoke(it.next()).floatValue();
|
||
|
while (it.hasNext()) {
|
||
|
floatValue = Math.min(floatValue, selector.invoke(it.next()).floatValue());
|
||
|
}
|
||
|
return floatValue;
|
||
|
}
|
||
|
|
||
|
/* renamed from: minOf, reason: collision with other method in class */
|
||
|
private static final <T, R extends Comparable<? super R>> R m6983minOf(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
R invoke = selector.invoke(it.next());
|
||
|
while (it.hasNext()) {
|
||
|
R invoke2 = selector.invoke(it.next());
|
||
|
if (invoke.compareTo(invoke2) > 0) {
|
||
|
invoke = invoke2;
|
||
|
}
|
||
|
}
|
||
|
return invoke;
|
||
|
}
|
||
|
|
||
|
/* renamed from: minOfOrNull, reason: collision with other method in class */
|
||
|
private static final <T> Double m6984minOfOrNull(Sequence<? extends T> sequence, Function1<? super T, Double> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
double doubleValue = selector.invoke(it.next()).doubleValue();
|
||
|
while (it.hasNext()) {
|
||
|
doubleValue = Math.min(doubleValue, selector.invoke(it.next()).doubleValue());
|
||
|
}
|
||
|
return Double.valueOf(doubleValue);
|
||
|
}
|
||
|
|
||
|
/* renamed from: minOfOrNull, reason: collision with other method in class */
|
||
|
private static final <T> Float m6985minOfOrNull(Sequence<? extends T> sequence, Function1<? super T, Float> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
float floatValue = selector.invoke(it.next()).floatValue();
|
||
|
while (it.hasNext()) {
|
||
|
floatValue = Math.min(floatValue, selector.invoke(it.next()).floatValue());
|
||
|
}
|
||
|
return Float.valueOf(floatValue);
|
||
|
}
|
||
|
|
||
|
private static final <T, R extends Comparable<? super R>> R minOfOrNull(Sequence<? extends T> sequence, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
R invoke = selector.invoke(it.next());
|
||
|
while (it.hasNext()) {
|
||
|
R invoke2 = selector.invoke(it.next());
|
||
|
if (invoke.compareTo(invoke2) > 0) {
|
||
|
invoke = invoke2;
|
||
|
}
|
||
|
}
|
||
|
return invoke;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
private static final <T, R> R minOfWith(Sequence<? extends T> sequence, Comparator<? super R> comparator, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(comparator, "comparator");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
Object obj = (R) selector.invoke((T) it.next());
|
||
|
while (it.hasNext()) {
|
||
|
Object obj2 = (R) selector.invoke((T) it.next());
|
||
|
if (comparator.compare(obj, obj2) > 0) {
|
||
|
obj = (R) obj2;
|
||
|
}
|
||
|
}
|
||
|
return (R) obj;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
private static final <T, R> R minOfWithOrNull(Sequence<? extends T> sequence, Comparator<? super R> comparator, Function1<? super T, ? extends R> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(comparator, "comparator");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
Object obj = (R) selector.invoke((T) it.next());
|
||
|
while (it.hasNext()) {
|
||
|
Object obj2 = (R) selector.invoke((T) it.next());
|
||
|
if (comparator.compare(obj, obj2) > 0) {
|
||
|
obj = (R) obj2;
|
||
|
}
|
||
|
}
|
||
|
return (R) obj;
|
||
|
}
|
||
|
|
||
|
/* renamed from: minOrNull, reason: collision with other method in class */
|
||
|
public static final Double m6986minOrNull(Sequence<Double> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Double> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
double doubleValue = it.next().doubleValue();
|
||
|
while (it.hasNext()) {
|
||
|
doubleValue = Math.min(doubleValue, it.next().doubleValue());
|
||
|
}
|
||
|
return Double.valueOf(doubleValue);
|
||
|
}
|
||
|
|
||
|
/* renamed from: minOrNull, reason: collision with other method in class */
|
||
|
public static final Float m6987minOrNull(Sequence<Float> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Float> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
float floatValue = it.next().floatValue();
|
||
|
while (it.hasNext()) {
|
||
|
floatValue = Math.min(floatValue, it.next().floatValue());
|
||
|
}
|
||
|
return Float.valueOf(floatValue);
|
||
|
}
|
||
|
|
||
|
public static final <T extends Comparable<? super T>> T minOrNull(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
T next = it.next();
|
||
|
while (it.hasNext()) {
|
||
|
T next2 = it.next();
|
||
|
if (next.compareTo(next2) > 0) {
|
||
|
next = next2;
|
||
|
}
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static final <T> T minWithOrThrow(Sequence<? extends T> sequence, Comparator<? super T> comparator) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(comparator, "comparator");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
Object obj = (T) it.next();
|
||
|
while (it.hasNext()) {
|
||
|
Object obj2 = (T) it.next();
|
||
|
if (comparator.compare(obj, obj2) > 0) {
|
||
|
obj = (T) obj2;
|
||
|
}
|
||
|
}
|
||
|
return (T) obj;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static final <T> T minWithOrNull(Sequence<? extends T> sequence, Comparator<? super T> comparator) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(comparator, "comparator");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
Object obj = (T) it.next();
|
||
|
while (it.hasNext()) {
|
||
|
Object obj2 = (T) it.next();
|
||
|
if (comparator.compare(obj, obj2) > 0) {
|
||
|
obj = (T) obj2;
|
||
|
}
|
||
|
}
|
||
|
return (T) obj;
|
||
|
}
|
||
|
|
||
|
public static final <T> boolean none(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return !sequence.iterator().hasNext();
|
||
|
}
|
||
|
|
||
|
public static final <T> boolean none(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
if (predicate.invoke(it.next()).booleanValue()) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> onEach(Sequence<? extends T> sequence, final Function1<? super T, Unit> action) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(action, "action");
|
||
|
return SequencesKt.map(sequence, new Function1<T, T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$onEach$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
{
|
||
|
super(1);
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final T invoke(T t) {
|
||
|
action.invoke(t);
|
||
|
return t;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> onEachIndexed(Sequence<? extends T> sequence, final Function2<? super Integer, ? super T, Unit> action) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(action, "action");
|
||
|
return SequencesKt.mapIndexed(sequence, new Function2<Integer, T, T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$onEachIndexed$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
{
|
||
|
super(2);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // kotlin.jvm.functions.Function2
|
||
|
public /* bridge */ /* synthetic */ Object invoke(Integer num, Object obj) {
|
||
|
return invoke(num.intValue(), (int) obj);
|
||
|
}
|
||
|
|
||
|
public final T invoke(int i, T t) {
|
||
|
action.invoke(Integer.valueOf(i), t);
|
||
|
return t;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public static final <S, T extends S> S reduce(Sequence<? extends T> sequence, Function2<? super S, ? super T, ? extends S> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new UnsupportedOperationException("Empty sequence can't be reduced.");
|
||
|
}
|
||
|
S next = it.next();
|
||
|
while (it.hasNext()) {
|
||
|
next = operation.invoke(next, it.next());
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
public static final <S, T extends S> S reduceIndexed(Sequence<? extends T> sequence, Function3<? super Integer, ? super S, ? super T, ? extends S> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
throw new UnsupportedOperationException("Empty sequence can't be reduced.");
|
||
|
}
|
||
|
S next = it.next();
|
||
|
int i = 1;
|
||
|
while (it.hasNext()) {
|
||
|
int i2 = i + 1;
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
next = operation.invoke(Integer.valueOf(i), next, it.next());
|
||
|
i = i2;
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
public static final <S, T extends S> S reduceIndexedOrNull(Sequence<? extends T> sequence, Function3<? super Integer, ? super S, ? super T, ? extends S> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
S next = it.next();
|
||
|
int i = 1;
|
||
|
while (it.hasNext()) {
|
||
|
int i2 = i + 1;
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
next = operation.invoke(Integer.valueOf(i), next, it.next());
|
||
|
i = i2;
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
public static final <S, T extends S> S reduceOrNull(Sequence<? extends T> sequence, Function2<? super S, ? super T, ? extends S> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
if (!it.hasNext()) {
|
||
|
return null;
|
||
|
}
|
||
|
S next = it.next();
|
||
|
while (it.hasNext()) {
|
||
|
next = operation.invoke(next, it.next());
|
||
|
}
|
||
|
return next;
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> runningFold(Sequence<? extends T> sequence, R r, Function2<? super R, ? super T, ? extends R> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
return SequencesKt.sequence(new SequencesKt___SequencesKt$runningFold$1(r, sequence, operation, null));
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> runningFoldIndexed(Sequence<? extends T> sequence, R r, Function3<? super Integer, ? super R, ? super T, ? extends R> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
return SequencesKt.sequence(new SequencesKt___SequencesKt$runningFoldIndexed$1(r, sequence, operation, null));
|
||
|
}
|
||
|
|
||
|
public static final <S, T extends S> Sequence<S> runningReduce(Sequence<? extends T> sequence, Function2<? super S, ? super T, ? extends S> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
return SequencesKt.sequence(new SequencesKt___SequencesKt$runningReduce$1(sequence, operation, null));
|
||
|
}
|
||
|
|
||
|
public static final <S, T extends S> Sequence<S> runningReduceIndexed(Sequence<? extends T> sequence, Function3<? super Integer, ? super S, ? super T, ? extends S> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
return SequencesKt.sequence(new SequencesKt___SequencesKt$runningReduceIndexed$1(sequence, operation, null));
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> scan(Sequence<? extends T> sequence, R r, Function2<? super R, ? super T, ? extends R> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
return SequencesKt.runningFold(sequence, r, operation);
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> scanIndexed(Sequence<? extends T> sequence, R r, Function3<? super Integer, ? super R, ? super T, ? extends R> operation) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(operation, "operation");
|
||
|
return SequencesKt.runningFoldIndexed(sequence, r, operation);
|
||
|
}
|
||
|
|
||
|
@Deprecated(message = "Use sumOf instead.", replaceWith = @ReplaceWith(expression = "this.sumOf(selector)", imports = {}))
|
||
|
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||
|
public static final <T> int sumBy(Sequence<? extends T> sequence, Function1<? super T, Integer> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
i += selector.invoke(it.next()).intValue();
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
@Deprecated(message = "Use sumOf instead.", replaceWith = @ReplaceWith(expression = "this.sumOf(selector)", imports = {}))
|
||
|
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||
|
public static final <T> double sumByDouble(Sequence<? extends T> sequence, Function1<? super T, Double> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
double d = BuildConfig.SENTRY_SAMPLE_RATE;
|
||
|
while (it.hasNext()) {
|
||
|
d += selector.invoke(it.next()).doubleValue();
|
||
|
}
|
||
|
return d;
|
||
|
}
|
||
|
|
||
|
private static final <T> double sumOfDouble(Sequence<? extends T> sequence, Function1<? super T, Double> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
double d = BuildConfig.SENTRY_SAMPLE_RATE;
|
||
|
while (it.hasNext()) {
|
||
|
d += selector.invoke(it.next()).doubleValue();
|
||
|
}
|
||
|
return d;
|
||
|
}
|
||
|
|
||
|
private static final <T> int sumOfInt(Sequence<? extends T> sequence, Function1<? super T, Integer> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
i += selector.invoke(it.next()).intValue();
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
private static final <T> long sumOfLong(Sequence<? extends T> sequence, Function1<? super T, Long> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
long j = 0;
|
||
|
while (it.hasNext()) {
|
||
|
j += selector.invoke(it.next()).longValue();
|
||
|
}
|
||
|
return j;
|
||
|
}
|
||
|
|
||
|
private static final <T> int sumOfUInt(Sequence<? extends T> sequence, Function1<? super T, UInt> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
int m5793constructorimpl = UInt.m5793constructorimpl(0);
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
m5793constructorimpl = UInt.m5793constructorimpl(m5793constructorimpl + selector.invoke(it.next()).getData());
|
||
|
}
|
||
|
return m5793constructorimpl;
|
||
|
}
|
||
|
|
||
|
private static final <T> long sumOfULong(Sequence<? extends T> sequence, Function1<? super T, ULong> selector) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(selector, "selector");
|
||
|
long m5872constructorimpl = ULong.m5872constructorimpl(0L);
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
m5872constructorimpl = ULong.m5872constructorimpl(m5872constructorimpl + selector.invoke(it.next()).getData());
|
||
|
}
|
||
|
return m5872constructorimpl;
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> requireNoNulls(final Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SequencesKt.map(sequence, new Function1<T, T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$requireNoNulls$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
{
|
||
|
super(1);
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final T invoke(T t) {
|
||
|
if (t != null) {
|
||
|
return t;
|
||
|
}
|
||
|
throw new IllegalArgumentException("null element found in " + sequence + '.');
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<List<T>> chunked(Sequence<? extends T> sequence, int i) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SequencesKt.windowed(sequence, i, i, true);
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> chunked(Sequence<? extends T> sequence, int i, Function1<? super List<? extends T>, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return SequencesKt.windowed(sequence, i, i, true, transform);
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> minus(final Sequence<? extends T> sequence, final T t) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return new Sequence<T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$minus$1
|
||
|
@Override // kotlin.sequences.Sequence
|
||
|
public Iterator<T> iterator() {
|
||
|
final Ref.BooleanRef booleanRef = new Ref.BooleanRef();
|
||
|
Sequence<T> sequence2 = sequence;
|
||
|
final T t2 = t;
|
||
|
return SequencesKt.filter(sequence2, new Function1<T, Boolean>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$minus$1$iterator$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
{
|
||
|
super(1);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final Boolean invoke(T t3) {
|
||
|
boolean z = true;
|
||
|
if (!Ref.BooleanRef.this.element && Intrinsics.areEqual(t3, t2)) {
|
||
|
Ref.BooleanRef.this.element = true;
|
||
|
z = false;
|
||
|
}
|
||
|
return Boolean.valueOf(z);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Boolean invoke(Object obj) {
|
||
|
return invoke((SequencesKt___SequencesKt$minus$1$iterator$1<T>) obj);
|
||
|
}
|
||
|
}).iterator();
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public static final <T> Sequence<T> minus(final Sequence<? extends T> sequence, final T[] elements) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(elements, "elements");
|
||
|
return elements.length == 0 ? sequence : new Sequence<T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$minus$2
|
||
|
@Override // kotlin.sequences.Sequence
|
||
|
public Iterator<T> iterator() {
|
||
|
Sequence<T> sequence2 = sequence;
|
||
|
final T[] tArr = elements;
|
||
|
return SequencesKt.filterNot(sequence2, new Function1<T, Boolean>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$minus$2$iterator$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
{
|
||
|
super(1);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final Boolean invoke(T t) {
|
||
|
return Boolean.valueOf(ArraysKt.contains(tArr, t));
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Boolean invoke(Object obj) {
|
||
|
return invoke((SequencesKt___SequencesKt$minus$2$iterator$1<T>) obj);
|
||
|
}
|
||
|
}).iterator();
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> minus(final Sequence<? extends T> sequence, final Iterable<? extends T> elements) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(elements, "elements");
|
||
|
return new Sequence<T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$minus$3
|
||
|
@Override // kotlin.sequences.Sequence
|
||
|
public Iterator<T> iterator() {
|
||
|
final Collection convertToListIfNotCollection = CollectionsKt.convertToListIfNotCollection(elements);
|
||
|
if (convertToListIfNotCollection.isEmpty()) {
|
||
|
return sequence.iterator();
|
||
|
}
|
||
|
return SequencesKt.filterNot(sequence, new Function1<T, Boolean>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$minus$3$iterator$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
{
|
||
|
super(1);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final Boolean invoke(T t) {
|
||
|
return Boolean.valueOf(convertToListIfNotCollection.contains(t));
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Boolean invoke(Object obj) {
|
||
|
return invoke((SequencesKt___SequencesKt$minus$3$iterator$1<T>) obj);
|
||
|
}
|
||
|
}).iterator();
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> minus(final Sequence<? extends T> sequence, final Sequence<? extends T> elements) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(elements, "elements");
|
||
|
return new Sequence<T>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$minus$4
|
||
|
@Override // kotlin.sequences.Sequence
|
||
|
public Iterator<T> iterator() {
|
||
|
final List list = SequencesKt.toList(elements);
|
||
|
if (list.isEmpty()) {
|
||
|
return sequence.iterator();
|
||
|
}
|
||
|
return SequencesKt.filterNot(sequence, new Function1<T, Boolean>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$minus$4$iterator$1
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
{
|
||
|
super(1);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Can't rename method to resolve collision */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public final Boolean invoke(T t) {
|
||
|
return Boolean.valueOf(list.contains(t));
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // kotlin.jvm.functions.Function1
|
||
|
public /* bridge */ /* synthetic */ Boolean invoke(Object obj) {
|
||
|
return invoke((SequencesKt___SequencesKt$minus$4$iterator$1<T>) obj);
|
||
|
}
|
||
|
}).iterator();
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
private static final <T> Sequence<T> minusElement(Sequence<? extends T> sequence, T t) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SequencesKt.minus(sequence, t);
|
||
|
}
|
||
|
|
||
|
public static final <T> Pair<List<T>, List<T>> partition(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
ArrayList arrayList2 = new ArrayList();
|
||
|
for (T t : sequence) {
|
||
|
if (predicate.invoke(t).booleanValue()) {
|
||
|
arrayList.add(t);
|
||
|
} else {
|
||
|
arrayList2.add(t);
|
||
|
}
|
||
|
}
|
||
|
return new Pair<>(arrayList, arrayList2);
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> plus(Sequence<? extends T> sequence, T t) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SequencesKt.flatten(SequencesKt.sequenceOf(sequence, SequencesKt.sequenceOf(t)));
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> plus(Sequence<? extends T> sequence, T[] elements) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(elements, "elements");
|
||
|
return SequencesKt.plus((Sequence) sequence, (Iterable) ArraysKt.asList(elements));
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> plus(Sequence<? extends T> sequence, Iterable<? extends T> elements) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(elements, "elements");
|
||
|
return SequencesKt.flatten(SequencesKt.sequenceOf(sequence, CollectionsKt.asSequence(elements)));
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<T> plus(Sequence<? extends T> sequence, Sequence<? extends T> elements) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(elements, "elements");
|
||
|
return SequencesKt.flatten(SequencesKt.sequenceOf(sequence, elements));
|
||
|
}
|
||
|
|
||
|
private static final <T> Sequence<T> plusElement(Sequence<? extends T> sequence, T t) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SequencesKt.plus(sequence, t);
|
||
|
}
|
||
|
|
||
|
public static /* synthetic */ Sequence windowed$default(Sequence sequence, int i, int i2, boolean z, int i3, Object obj) {
|
||
|
if ((i3 & 2) != 0) {
|
||
|
i2 = 1;
|
||
|
}
|
||
|
if ((i3 & 4) != 0) {
|
||
|
z = false;
|
||
|
}
|
||
|
return SequencesKt.windowed(sequence, i, i2, z);
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<List<T>> windowed(Sequence<? extends T> sequence, int i, int i2, boolean z) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SlidingWindowKt.windowedSequence(sequence, i, i2, z, false);
|
||
|
}
|
||
|
|
||
|
public static /* synthetic */ Sequence windowed$default(Sequence sequence, int i, int i2, boolean z, Function1 function1, int i3, Object obj) {
|
||
|
if ((i3 & 2) != 0) {
|
||
|
i2 = 1;
|
||
|
}
|
||
|
if ((i3 & 4) != 0) {
|
||
|
z = false;
|
||
|
}
|
||
|
return SequencesKt.windowed(sequence, i, i2, z, function1);
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> windowed(Sequence<? extends T> sequence, int i, int i2, boolean z, Function1<? super List<? extends T>, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return SequencesKt.map(SlidingWindowKt.windowedSequence(sequence, i, i2, z, true), transform);
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<Pair<T, R>> zip(Sequence<? extends T> sequence, Sequence<? extends R> other) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(other, "other");
|
||
|
return new MergingSequence(sequence, other, new Function2<T, R, Pair<? extends T, ? extends R>>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$zip$1
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
@Override // kotlin.jvm.functions.Function2
|
||
|
public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
|
||
|
return invoke((SequencesKt___SequencesKt$zip$1<R, T>) obj, obj2);
|
||
|
}
|
||
|
|
||
|
@Override // kotlin.jvm.functions.Function2
|
||
|
public final Pair<T, R> invoke(T t, R r) {
|
||
|
return TuplesKt.to(t, r);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public static final <T, R, V> Sequence<V> zip(Sequence<? extends T> sequence, Sequence<? extends R> other, Function2<? super T, ? super R, ? extends V> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(other, "other");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return new MergingSequence(sequence, other, transform);
|
||
|
}
|
||
|
|
||
|
public static final <T> Sequence<Pair<T, T>> zipWithNext(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return SequencesKt.zipWithNext(sequence, new Function2<T, T, Pair<? extends T, ? extends T>>() { // from class: kotlin.sequences.SequencesKt___SequencesKt$zipWithNext$1
|
||
|
@Override // kotlin.jvm.functions.Function2
|
||
|
public final Pair<T, T> invoke(T t, T t2) {
|
||
|
return TuplesKt.to(t, t2);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public static final <T, R> Sequence<R> zipWithNext(Sequence<? extends T> sequence, Function2<? super T, ? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
return SequencesKt.sequence(new SequencesKt___SequencesKt$zipWithNext$2(sequence, transform, null));
|
||
|
}
|
||
|
|
||
|
public static final <T, A extends Appendable> A joinTo(Sequence<? extends T> sequence, A buffer, CharSequence separator, CharSequence prefix, CharSequence postfix, int i, CharSequence truncated, Function1<? super T, ? extends CharSequence> function1) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(buffer, "buffer");
|
||
|
Intrinsics.checkNotNullParameter(separator, "separator");
|
||
|
Intrinsics.checkNotNullParameter(prefix, "prefix");
|
||
|
Intrinsics.checkNotNullParameter(postfix, "postfix");
|
||
|
Intrinsics.checkNotNullParameter(truncated, "truncated");
|
||
|
buffer.append(prefix);
|
||
|
int i2 = 0;
|
||
|
for (T t : sequence) {
|
||
|
i2++;
|
||
|
if (i2 > 1) {
|
||
|
buffer.append(separator);
|
||
|
}
|
||
|
if (i >= 0 && i2 > i) {
|
||
|
break;
|
||
|
}
|
||
|
StringsKt.appendElement(buffer, t, function1);
|
||
|
}
|
||
|
if (i >= 0 && i2 > i) {
|
||
|
buffer.append(truncated);
|
||
|
}
|
||
|
buffer.append(postfix);
|
||
|
return buffer;
|
||
|
}
|
||
|
|
||
|
public static /* synthetic */ String joinToString$default(Sequence sequence, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, int i, CharSequence charSequence4, Function1 function1, int i2, Object obj) {
|
||
|
if ((i2 & 1) != 0) {
|
||
|
}
|
||
|
if ((i2 & 2) != 0) {
|
||
|
}
|
||
|
CharSequence charSequence5 = charSequence2;
|
||
|
if ((i2 & 4) != 0) {
|
||
|
}
|
||
|
CharSequence charSequence6 = charSequence3;
|
||
|
if ((i2 & 8) != 0) {
|
||
|
i = -1;
|
||
|
}
|
||
|
int i3 = i;
|
||
|
if ((i2 & 16) != 0) {
|
||
|
}
|
||
|
CharSequence charSequence7 = charSequence4;
|
||
|
if ((i2 & 32) != 0) {
|
||
|
function1 = null;
|
||
|
}
|
||
|
return SequencesKt.joinToString(sequence, charSequence, charSequence5, charSequence6, i3, charSequence7, function1);
|
||
|
}
|
||
|
|
||
|
public static final <T> String joinToString(Sequence<? extends T> sequence, CharSequence separator, CharSequence prefix, CharSequence postfix, int i, CharSequence truncated, Function1<? super T, ? extends CharSequence> function1) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(separator, "separator");
|
||
|
Intrinsics.checkNotNullParameter(prefix, "prefix");
|
||
|
Intrinsics.checkNotNullParameter(postfix, "postfix");
|
||
|
Intrinsics.checkNotNullParameter(truncated, "truncated");
|
||
|
String sb = ((StringBuilder) SequencesKt.joinTo(sequence, new StringBuilder(), separator, prefix, postfix, i, truncated, function1)).toString();
|
||
|
Intrinsics.checkNotNullExpressionValue(sb, "toString(...)");
|
||
|
return sb;
|
||
|
}
|
||
|
|
||
|
public static final <T> Iterable<T> asIterable(Sequence<? extends T> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
return new SequencesKt___SequencesKt$asIterable$$inlined$Iterable$1(sequence);
|
||
|
}
|
||
|
|
||
|
public static final double averageOfByte(Sequence<Byte> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Byte> it = sequence.iterator();
|
||
|
double d = BuildConfig.SENTRY_SAMPLE_RATE;
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
d += it.next().byteValue();
|
||
|
i++;
|
||
|
if (i < 0) {
|
||
|
CollectionsKt.throwCountOverflow();
|
||
|
}
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
return Double.NaN;
|
||
|
}
|
||
|
return d / i;
|
||
|
}
|
||
|
|
||
|
public static final double averageOfShort(Sequence<Short> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Short> it = sequence.iterator();
|
||
|
double d = BuildConfig.SENTRY_SAMPLE_RATE;
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
d += it.next().shortValue();
|
||
|
i++;
|
||
|
if (i < 0) {
|
||
|
CollectionsKt.throwCountOverflow();
|
||
|
}
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
return Double.NaN;
|
||
|
}
|
||
|
return d / i;
|
||
|
}
|
||
|
|
||
|
public static final double averageOfInt(Sequence<Integer> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Integer> it = sequence.iterator();
|
||
|
double d = BuildConfig.SENTRY_SAMPLE_RATE;
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
d += it.next().intValue();
|
||
|
i++;
|
||
|
if (i < 0) {
|
||
|
CollectionsKt.throwCountOverflow();
|
||
|
}
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
return Double.NaN;
|
||
|
}
|
||
|
return d / i;
|
||
|
}
|
||
|
|
||
|
public static final double averageOfLong(Sequence<Long> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Long> it = sequence.iterator();
|
||
|
double d = BuildConfig.SENTRY_SAMPLE_RATE;
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
d += it.next().longValue();
|
||
|
i++;
|
||
|
if (i < 0) {
|
||
|
CollectionsKt.throwCountOverflow();
|
||
|
}
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
return Double.NaN;
|
||
|
}
|
||
|
return d / i;
|
||
|
}
|
||
|
|
||
|
public static final double averageOfFloat(Sequence<Float> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Float> it = sequence.iterator();
|
||
|
double d = BuildConfig.SENTRY_SAMPLE_RATE;
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
d += it.next().floatValue();
|
||
|
i++;
|
||
|
if (i < 0) {
|
||
|
CollectionsKt.throwCountOverflow();
|
||
|
}
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
return Double.NaN;
|
||
|
}
|
||
|
return d / i;
|
||
|
}
|
||
|
|
||
|
public static final double averageOfDouble(Sequence<Double> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Double> it = sequence.iterator();
|
||
|
double d = BuildConfig.SENTRY_SAMPLE_RATE;
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
d += it.next().doubleValue();
|
||
|
i++;
|
||
|
if (i < 0) {
|
||
|
CollectionsKt.throwCountOverflow();
|
||
|
}
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
return Double.NaN;
|
||
|
}
|
||
|
return d / i;
|
||
|
}
|
||
|
|
||
|
public static final int sumOfByte(Sequence<Byte> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Byte> it = sequence.iterator();
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
i += it.next().byteValue();
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
public static final int sumOfShort(Sequence<Short> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Short> it = sequence.iterator();
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
i += it.next().shortValue();
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
public static final int sumOfInt(Sequence<Integer> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Integer> it = sequence.iterator();
|
||
|
int i = 0;
|
||
|
while (it.hasNext()) {
|
||
|
i += it.next().intValue();
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
|
||
|
public static final long sumOfLong(Sequence<Long> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Long> it = sequence.iterator();
|
||
|
long j = 0;
|
||
|
while (it.hasNext()) {
|
||
|
j += it.next().longValue();
|
||
|
}
|
||
|
return j;
|
||
|
}
|
||
|
|
||
|
public static final float sumOfFloat(Sequence<Float> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Float> it = sequence.iterator();
|
||
|
float f = 0.0f;
|
||
|
while (it.hasNext()) {
|
||
|
f += it.next().floatValue();
|
||
|
}
|
||
|
return f;
|
||
|
}
|
||
|
|
||
|
public static final double sumOfDouble(Sequence<Double> sequence) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Iterator<Double> it = sequence.iterator();
|
||
|
double d = BuildConfig.SENTRY_SAMPLE_RATE;
|
||
|
while (it.hasNext()) {
|
||
|
d += it.next().doubleValue();
|
||
|
}
|
||
|
return d;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Type inference failed for: r0v4, types: [T, java.lang.Object] */
|
||
|
private static final <T> T find(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
for (T t : sequence) {
|
||
|
if (predicate.invoke(t).booleanValue()) {
|
||
|
return t;
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
/* JADX WARN: Type inference failed for: r1v1, types: [java.lang.Object] */
|
||
|
private static final <T> T findLast(Sequence<? extends T> sequence, Function1<? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
T t = null;
|
||
|
for (T t2 : sequence) {
|
||
|
if (predicate.invoke(t2).booleanValue()) {
|
||
|
t = t2;
|
||
|
}
|
||
|
}
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
public static final <T, C extends Collection<? super T>> C filterIndexedTo(Sequence<? extends T> sequence, C destination, Function2<? super Integer, ? super T, Boolean> predicate) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(predicate, "predicate");
|
||
|
int i = 0;
|
||
|
for (T t : sequence) {
|
||
|
int i2 = i + 1;
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
if (predicate.invoke(Integer.valueOf(i), t).booleanValue()) {
|
||
|
destination.add(t);
|
||
|
}
|
||
|
i = i2;
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, R, C extends Collection<? super R>> C mapIndexedNotNullTo(Sequence<? extends T> sequence, C destination, Function2<? super Integer, ? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
int i = 0;
|
||
|
for (T t : sequence) {
|
||
|
int i2 = i + 1;
|
||
|
if (i < 0) {
|
||
|
if (!PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) {
|
||
|
throw new ArithmeticException("Index overflow has happened.");
|
||
|
}
|
||
|
CollectionsKt.throwIndexOverflow();
|
||
|
}
|
||
|
R invoke = transform.invoke(Integer.valueOf(i), t);
|
||
|
if (invoke != null) {
|
||
|
destination.add(invoke);
|
||
|
}
|
||
|
i = i2;
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
|
||
|
public static final <T, R, C extends Collection<? super R>> C mapNotNullTo(Sequence<? extends T> sequence, C destination, Function1<? super T, ? extends R> transform) {
|
||
|
Intrinsics.checkNotNullParameter(sequence, "<this>");
|
||
|
Intrinsics.checkNotNullParameter(destination, "destination");
|
||
|
Intrinsics.checkNotNullParameter(transform, "transform");
|
||
|
Iterator<? extends T> it = sequence.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
R invoke = transform.invoke(it.next());
|
||
|
if (invoke != null) {
|
||
|
destination.add(invoke);
|
||
|
}
|
||
|
}
|
||
|
return destination;
|
||
|
}
|
||
|
}
|