package f.a.n.h;

/* JADX INFO: compiled from: AppendOnlyLinkedArrayList.java */
/* JADX INFO: loaded from: classes.dex */
public class a<T> {
    final int a;
    final Object[] b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    Object[] f923c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    int f924d;

    /* JADX WARN: Unexpected interfaces in signature: [java.lang.Object<T>] */
    /* JADX INFO: renamed from: f.a.n.h.a$a, reason: collision with other inner class name */
    /* JADX INFO: compiled from: AppendOnlyLinkedArrayList.java */
    public interface InterfaceC0054a<T> {
        boolean test(T t);
    }

    public a(int i2) {
        this.a = i2;
        Object[] objArr = new Object[i2 + 1];
        this.b = objArr;
        this.f923c = objArr;
    }

    /* JADX WARN: Code restructure failed: missing block: B:19:0x0019, code lost:
    
        continue;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public <U> boolean a(f.a.f<? super U> r5) {
        /*
            r4 = this;
            java.lang.Object[] r0 = r4.b
            int r1 = r4.a
        L4:
            r2 = 0
            if (r0 == 0) goto L1e
        L7:
            if (r2 >= r1) goto L19
            r3 = r0[r2]
            if (r3 != 0) goto Le
            goto L19
        Le:
            boolean r3 = f.a.n.h.c.acceptFull(r3, r5)
            if (r3 == 0) goto L16
            r5 = 1
            return r5
        L16:
            int r2 = r2 + 1
            goto L7
        L19:
            r0 = r0[r1]
            java.lang.Object[] r0 = (java.lang.Object[]) r0
            goto L4
        L1e:
            return r2
        */
        throw new UnsupportedOperationException("Method not decompiled: f.a.n.h.a.a(f.a.f):boolean");
    }

    public void b(T t) {
        int i2 = this.a;
        int i3 = this.f924d;
        if (i3 == i2) {
            Object[] objArr = new Object[i2 + 1];
            this.f923c[i2] = objArr;
            this.f923c = objArr;
            i3 = 0;
        }
        this.f923c[i3] = t;
        this.f924d = i3 + 1;
    }

    public void c(InterfaceC0054a<? super T> interfaceC0054a) {
        int i2;
        int i3 = this.a;
        for (Object[] objArr = this.b; objArr != null; objArr = (Object[]) objArr[i3]) {
            while (i2 < i3) {
                Object obj = objArr[i2];
                i2 = (obj == null || interfaceC0054a.test(obj)) ? 0 : i2 + 1;
            }
        }
    }

    public void d(T t) {
        this.b[0] = t;
    }
}
