discord-jadx/app/src/main/java/ra/y.java

185 lines
4.5 KiB
Java

package ra;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
import qa.g;
import qa.h;
/* compiled from: Iterators.java */
/* loaded from: classes4.dex */
public final class y {
/* compiled from: Iterators.java */
/* loaded from: classes4.dex */
static class a extends u0<T> {
/* renamed from: j reason: collision with root package name */
boolean f21799j;
/* renamed from: k reason: collision with root package name */
final /* synthetic */ Object f21800k;
a(Object obj) {
this.f21800k = obj;
}
@Override // java.util.Iterator
public boolean hasNext() {
return !this.f21799j;
}
@Override // java.util.Iterator
public T next() {
if (!this.f21799j) {
this.f21799j = true;
return this.f21800k;
}
throw new NoSuchElementException();
}
}
/* compiled from: Iterators.java */
/* loaded from: classes4.dex */
private static final class b<T> extends a<T> {
/* renamed from: n reason: collision with root package name */
static final v0<Object> f21801n = new b(new Object[0], 0, 0, 0);
/* renamed from: l reason: collision with root package name */
private final T[] f21802l;
/* renamed from: m reason: collision with root package name */
private final int f21803m;
b(T[] tArr, int i10, int i11, int i12) {
super(i11, i12);
this.f21802l = tArr;
this.f21803m = i10;
}
@Override // ra.a
protected T b(int i10) {
return this.f21802l[this.f21803m + i10];
}
}
/* compiled from: Iterators.java */
/* loaded from: classes4.dex */
private enum c implements Iterator<Object> {
INSTANCE;
@Override // java.util.Iterator
public boolean hasNext() {
return false;
}
@Override // java.util.Iterator
public Object next() {
throw new NoSuchElementException();
}
@Override // java.util.Iterator
public void remove() {
i.c(false);
}
}
/* JADX WARN: Multi-variable type inference failed */
public static <T> boolean a(Collection<T> collection, Iterator<? extends T> it) {
h.j(collection);
h.j(it);
boolean z10 = false;
while (it.hasNext()) {
z10 |= collection.add(it.next());
}
return z10;
}
static void b(Iterator<?> it) {
h.j(it);
while (it.hasNext()) {
it.next();
it.remove();
}
}
/* JADX WARN: Removed duplicated region for block: B:4:0x0006 */
/*
Code decompiled incorrectly, please refer to instructions dump.
*/
public static boolean c(Iterator<?> it, Iterator<?> it2) {
while (it.hasNext()) {
if (!it2.hasNext() || !g.a(it.next(), it2.next())) {
return false;
}
while (it.hasNext()) {
}
}
return !it2.hasNext();
}
static <T> u0<T> d() {
return e();
}
static <T> v0<T> e() {
return (v0<T>) b.f21801n;
}
static <T> Iterator<T> f() {
return c.INSTANCE;
}
public static <T> T g(Iterator<T> it) {
T next;
do {
next = it.next();
} while (it.hasNext());
return next;
}
public static <T> T h(Iterator<? extends T> it, T t10) {
return it.hasNext() ? (T) it.next() : t10;
}
static <T> T i(Iterator<T> it) {
if (!it.hasNext()) {
return null;
}
T next = it.next();
it.remove();
return next;
}
public static boolean j(Iterator<?> it, Collection<?> collection) {
h.j(collection);
boolean z10 = false;
while (it.hasNext()) {
if (collection.contains(it.next())) {
it.remove();
z10 = true;
}
}
return z10;
}
public static <T> u0<T> k(T t10) {
return new a(t10);
}
public static String l(Iterator<?> it) {
StringBuilder sb2 = new StringBuilder();
sb2.append('[');
boolean z10 = true;
while (it.hasNext()) {
if (!z10) {
sb2.append(", ");
}
z10 = false;
sb2.append(it.next());
}
sb2.append(']');
return sb2.toString();
}
}