package p054r1;

import java.util.Iterator;
import java.util.concurrent.atomic.AtomicReference;
import p039m1.C1470g;

/* renamed from: r1.a */
/* loaded from: classes.dex */
public final class C1595a<T> implements InterfaceC1596b<T> {

    /* renamed from: a */
    public final AtomicReference<InterfaceC1596b<T>> f3731a;

    public C1595a(InterfaceC1596b<? extends T> interfaceC1596b) {
        C1470g.m1292e(interfaceC1596b, "sequence");
        this.f3731a = new AtomicReference<>(interfaceC1596b);
    }

    @Override // p054r1.InterfaceC1596b
    public Iterator<T> iterator() {
        InterfaceC1596b<T> andSet = this.f3731a.getAndSet(null);
        if (andSet != null) {
            return andSet.iterator();
        }
        throw new IllegalStateException("This sequence can be consumed only once.");
    }
}