package c.f.i;

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f1389b;

    public c(int i2) {
        if (i2 <= 0) {
            throw new IllegalArgumentException("The max pool size must be > 0");
        }
        this.a = new Object[i2];
    }

    public T a() {
        int i2 = this.f1389b;
        if (i2 <= 0) {
            return null;
        }
        int i3 = i2 - 1;
        Object[] objArr = this.a;
        T t = (T) objArr[i3];
        objArr[i3] = null;
        this.f1389b = i2 - 1;
        return t;
    }

    public boolean b(T t) {
        int i2;
        boolean z;
        int i3 = 0;
        while (true) {
            i2 = this.f1389b;
            if (i3 >= i2) {
                z = false;
                break;
            }
            if (this.a[i3] == t) {
                z = true;
                break;
            }
            i3++;
        }
        if (z) {
            throw new IllegalStateException("Already in the pool!");
        }
        Object[] objArr = this.a;
        if (i2 >= objArr.length) {
            return false;
        }
        objArr[i2] = t;
        this.f1389b = i2 + 1;
        return true;
    }
}
