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

312 lines
8.1 KiB
Java

package o;
import com.huawei.hms.framework.common.ContainerUtils;
import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;
/* loaded from: classes.dex */
public class hFr<K, V> implements Iterable<Map.Entry<K, V>> {
public Sts<K, V> a;
public WeakHashMap<saX<K, V>, Boolean> c = new WeakHashMap<>();
public int d = 0;
public Sts<K, V> e;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public interface saX<K, V> {
void a_(Sts<K, V> sts);
}
protected Sts<K, V> d(K k) {
Sts<K, V> sts = this.a;
while (sts != null && !sts.a.equals(k)) {
sts = sts.b;
}
return sts;
}
public V a(K k, V v) {
Sts<K, V> d = d(k);
if (d != null) {
return d.e;
}
c(k, v);
return null;
}
/* JADX INFO: Access modifiers changed from: protected */
public final Sts<K, V> c(K k, V v) {
Sts<K, V> sts = new Sts<>(k, v);
this.d++;
Sts<K, V> sts2 = this.e;
if (sts2 == null) {
this.a = sts;
this.e = sts;
return sts;
}
sts2.b = sts;
sts.c = this.e;
this.e = sts;
return sts;
}
public V b(K k) {
Sts<K, V> d = d(k);
if (d == null) {
return null;
}
this.d--;
if (!this.c.isEmpty()) {
Iterator<saX<K, V>> it = this.c.keySet().iterator();
while (it.hasNext()) {
it.next().a_(d);
}
}
if (d.c != null) {
d.c.b = d.b;
} else {
this.a = d.b;
}
if (d.b != null) {
d.b.c = d.c;
} else {
this.e = d.c;
}
d.b = null;
d.c = null;
return d.e;
}
@Override // java.lang.Iterable
public Iterator<Map.Entry<K, V>> iterator() {
HBt hBt = new HBt(this.a, this.e);
this.c.put(hBt, Boolean.FALSE);
return hBt;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof hFr)) {
return false;
}
hFr hfr = (hFr) obj;
if (this.d != hfr.d) {
return false;
}
Iterator<Map.Entry<K, V>> it = iterator();
Iterator<Map.Entry<K, V>> it2 = hfr.iterator();
while (it.hasNext() && it2.hasNext()) {
Map.Entry<K, V> next = it.next();
Map.Entry<K, V> next2 = it2.next();
if ((next == null && next2 != null) || (next != null && !next.equals(next2))) {
return false;
}
}
return (it.hasNext() || it2.hasNext()) ? false : true;
}
public int hashCode() {
Iterator<Map.Entry<K, V>> it = iterator();
int i = 0;
while (it.hasNext()) {
i += it.next().hashCode();
}
return i;
}
public String toString() {
StringBuilder sb = new StringBuilder("[");
Iterator<Map.Entry<K, V>> it = iterator();
while (it.hasNext()) {
sb.append(it.next().toString());
if (it.hasNext()) {
sb.append(", ");
}
}
sb.append("]");
return sb.toString();
}
/* loaded from: classes.dex */
static abstract class RVV<K, V> implements Iterator<Map.Entry<K, V>>, saX<K, V> {
private Sts<K, V> a;
private Sts<K, V> e;
abstract Sts<K, V> b(Sts<K, V> sts);
abstract Sts<K, V> c(Sts<K, V> sts);
@Override // java.util.Iterator
public /* synthetic */ Object next() {
Sts<K, V> sts = this.e;
Sts<K, V> sts2 = this.a;
this.e = (sts == sts2 || sts2 == null) ? null : b(sts);
return sts;
}
RVV(Sts<K, V> sts, Sts<K, V> sts2) {
this.a = sts2;
this.e = sts;
}
@Override // o.hFr.saX
public final void a_(Sts<K, V> sts) {
Sts<K, V> sts2 = null;
if (this.a == sts && sts == this.e) {
this.e = null;
this.a = null;
}
Sts<K, V> sts3 = this.a;
if (sts3 == sts) {
this.a = c(sts3);
}
Sts<K, V> sts4 = this.e;
if (sts4 == sts) {
Sts<K, V> sts5 = this.a;
if (sts4 != sts5 && sts5 != null) {
sts2 = b(sts4);
}
this.e = sts2;
}
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.e != null;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class HBt<K, V> extends RVV<K, V> {
HBt(Sts<K, V> sts, Sts<K, V> sts2) {
super(sts, sts2);
}
@Override // o.hFr.RVV
final Sts<K, V> b(Sts<K, V> sts) {
return sts.b;
}
@Override // o.hFr.RVV
final Sts<K, V> c(Sts<K, V> sts) {
return sts.c;
}
}
/* loaded from: classes.dex */
public static class LWm<K, V> extends RVV<K, V> {
public LWm(Sts<K, V> sts, Sts<K, V> sts2) {
super(sts, sts2);
}
@Override // o.hFr.RVV
final Sts<K, V> b(Sts<K, V> sts) {
return sts.c;
}
@Override // o.hFr.RVV
final Sts<K, V> c(Sts<K, V> sts) {
return sts.b;
}
}
/* loaded from: classes.dex */
public class IeS implements Iterator<Map.Entry<K, V>>, saX<K, V> {
private boolean b = true;
final hFr c;
private Sts<K, V> d;
@Override // java.util.Iterator
public final /* bridge */ /* synthetic */ Object next() {
if (this.b) {
this.b = false;
this.d = this.c.a;
} else {
Sts<K, V> sts = this.d;
this.d = sts != null ? sts.b : null;
}
return this.d;
}
public IeS(hFr hfr) {
this.c = hfr;
}
@Override // o.hFr.saX
public final void a_(Sts<K, V> sts) {
Sts<K, V> sts2 = this.d;
if (sts == sts2) {
Sts<K, V> sts3 = sts2.c;
this.d = sts3;
this.b = sts3 == null;
}
}
@Override // java.util.Iterator
public final boolean hasNext() {
if (this.b) {
return this.c.a != null;
}
Sts<K, V> sts = this.d;
return (sts == null || sts.b == null) ? false : true;
}
}
/* loaded from: classes.dex */
public static class Sts<K, V> implements Map.Entry<K, V> {
final K a;
Sts<K, V> b;
public Sts<K, V> c;
final V e;
Sts(K k, V v) {
this.a = k;
this.e = v;
}
@Override // java.util.Map.Entry
public final V setValue(V v) {
throw new UnsupportedOperationException("An entry modification is not supported");
}
public final String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.a);
sb.append(ContainerUtils.KEY_VALUE_DELIMITER);
sb.append(this.e);
return sb.toString();
}
@Override // java.util.Map.Entry
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Sts)) {
return false;
}
Sts sts = (Sts) obj;
return this.a.equals(sts.a) && this.e.equals(sts.e);
}
@Override // java.util.Map.Entry
public final int hashCode() {
return this.a.hashCode() ^ this.e.hashCode();
}
@Override // java.util.Map.Entry
public final V getValue() {
return this.e;
}
@Override // java.util.Map.Entry
public final K getKey() {
return this.a;
}
}
}