alexandroid/decompiled/jadx/sources/com/google/common/base/AbstractIterator.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

71 lines
1.9 KiB
Java

package com.google.common.base;
import com.google.common.annotations.GwtCompatible;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Iterator;
import rx.Single$$ExternalSyntheticBUOutline0;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@GwtCompatible
/* loaded from: classes8.dex */
abstract class AbstractIterator<T> implements Iterator<T> {
private T next;
private State state = State.NOT_READY;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
public enum State {
READY,
NOT_READY,
DONE,
FAILED
}
private boolean tryToComputeNext() {
this.state = State.FAILED;
this.next = computeNext();
if (this.state == State.DONE) {
return false;
}
this.state = State.READY;
return true;
}
public abstract T computeNext();
@CanIgnoreReturnValue
public final T endOfData() {
this.state = State.DONE;
return null;
}
@Override // java.util.Iterator
public final boolean hasNext() {
Preconditions.checkState(this.state != State.FAILED);
int ordinal = this.state.ordinal();
if (ordinal == 0) {
return true;
}
if (ordinal != 2) {
return tryToComputeNext();
}
return false;
}
@Override // java.util.Iterator
@ParametricNullness
public final T next() {
if (!hasNext()) {
Single$$ExternalSyntheticBUOutline0.m();
return null;
}
this.state = State.NOT_READY;
T t = (T) NullnessCasts.uncheckedCastNullableTToT(this.next);
this.next = null;
return t;
}
@Override // java.util.Iterator
public final void remove() {
throw new UnsupportedOperationException();
}
}