what-the-bank/sources/o/C13378fYq.java

79 lines
2.1 KiB
Java

package o;
import java.util.concurrent.atomic.AtomicReference;
/* renamed from: o.fYq, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13378fYq<T> implements InterfaceC13408fZk<T> {
private final AtomicReference<LWm<T>> d;
private final AtomicReference<LWm<T>> e;
public C13378fYq() {
AtomicReference<LWm<T>> atomicReference = new AtomicReference<>();
this.d = atomicReference;
AtomicReference<LWm<T>> atomicReference2 = new AtomicReference<>();
this.e = atomicReference2;
LWm<T> lWm = new LWm<>();
atomicReference2.lazySet(lWm);
atomicReference.getAndSet(lWm);
}
@Override // o.InterfaceC13414fZq
public final boolean b(T t) {
if (t == null) {
throw new NullPointerException("Null is not a valid element");
}
LWm<T> lWm = new LWm<>(t);
this.d.getAndSet(lWm).lazySet(lWm);
return true;
}
@Override // o.InterfaceC13408fZk, o.InterfaceC13414fZq
public final T b() {
LWm lWm;
LWm<T> lWm2 = this.e.get();
LWm lWm3 = lWm2.get();
if (lWm3 != null) {
T t = lWm3.a;
lWm3.a = null;
this.e.lazySet(lWm3);
return t;
}
if (lWm2 == this.d.get()) {
return null;
}
do {
lWm = lWm2.get();
} while (lWm == null);
T t2 = lWm.a;
lWm.a = null;
this.e.lazySet(lWm);
return t2;
}
@Override // o.InterfaceC13414fZq
public final void e() {
while (b() != null && this.e.get() != this.d.get()) {
}
}
@Override // o.InterfaceC13414fZq
public final boolean c() {
return this.e.get() == this.d.get();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.fYq$LWm */
/* loaded from: classes6.dex */
public static final class LWm<E> extends AtomicReference<LWm<E>> {
E a;
LWm() {
}
LWm(E e) {
this.a = e;
}
}
}