package android.support.v4.f;

public class k$b<T> implements k$a<T> {
    private final Object[] gH;
    private int gI;

    public k$b(int i) {
        if (i <= 0) {
            throw new IllegalArgumentException("The max pool size must be > 0");
        }
        this.gH = new Object[i];
    }

    public T aA() {
        if (this.gI <= 0) {
            return null;
        }
        int i = this.gI - 1;
        T t = this.gH[i];
        this.gH[i] = null;
        this.gI--;
        return t;
    }

    public boolean release(T t) {
        boolean z;
        for (int i = 0; i < this.gI; i++) {
            if (this.gH[i] == t) {
                z = true;
                break;
            }
        }
        z = false;
        if (z) {
            throw new IllegalStateException("Already in the pool!");
        } else if (this.gI >= this.gH.length) {
            return false;
        } else {
            this.gH[this.gI] = t;
            this.gI++;
            return true;
        }
    }
}
