package X6FRs_4.IMuAHx_6.KNBe_11;
/* compiled from: Pools.java */
/* loaded from: classes.dex */
public class IFxWkV_5<T> implements X6FRs_4<T> {
    public int KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final Object[] f414KQgRr5e_0;

    public IFxWkV_5(int i) {
        if (i > 0) {
            this.f414KQgRr5e_0 = new Object[i];
            return;
        }
        throw new IllegalArgumentException("The max pool size must be > 0");
    }

    @Override // X6FRs_4.IMuAHx_6.KNBe_11.X6FRs_4
    public T KQgRr5e_0() {
        int i = this.KQgRr5e_0;
        if (i > 0) {
            int i2 = i - 1;
            Object[] objArr = this.f414KQgRr5e_0;
            T t = (T) objArr[i2];
            objArr[i2] = null;
            this.KQgRr5e_0 = i - 1;
            return t;
        }
        return null;
    }

    public final boolean QxJ9d_1(T t) {
        for (int i = 0; i < this.KQgRr5e_0; i++) {
            if (this.f414KQgRr5e_0[i] == t) {
                return true;
            }
        }
        return false;
    }

    @Override // X6FRs_4.IMuAHx_6.KNBe_11.X6FRs_4
    public boolean KQgRr5e_0(T t) {
        if (!QxJ9d_1(t)) {
            int i = this.KQgRr5e_0;
            Object[] objArr = this.f414KQgRr5e_0;
            if (i < objArr.length) {
                objArr[i] = t;
                this.KQgRr5e_0 = i + 1;
                return true;
            }
            return false;
        }
        throw new IllegalStateException("Already in the pool!");
    }
}
