package g;

import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: compiled from: UByteArray.kt */
/* JADX INFO: loaded from: classes.dex */
@i
public final class r implements Collection<q>, g.h0.c.g0.a {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final byte[] f4188b;

    /* JADX INFO: compiled from: UByteArray.kt */
    @i
    public static final class a implements Iterator<q>, g.h0.c.g0.a {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final byte[] f4189b;

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

        public a(byte[] bArr) {
            g.h0.c.l.f(bArr, "array");
            this.f4189b = bArr;
        }

        @Override // java.util.Iterator
        public boolean hasNext() {
            return this.f4190e < this.f4189b.length;
        }

        @Override // java.util.Iterator
        public q next() {
            int i2 = this.f4190e;
            byte[] bArr = this.f4189b;
            if (i2 >= bArr.length) {
                throw new NoSuchElementException(String.valueOf(this.f4190e));
            }
            this.f4190e = i2 + 1;
            return new q(bArr[i2]);
        }

        @Override // java.util.Iterator
        public void remove() {
            throw new UnsupportedOperationException("Operation is not supported for read-only collection");
        }
    }

    @Override // java.util.Collection
    public /* bridge */ /* synthetic */ boolean add(q qVar) {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.Collection
    public boolean addAll(Collection<? extends q> collection) {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.Collection
    public void clear() {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.Collection
    public final boolean contains(Object obj) {
        if (!(obj instanceof q)) {
            return false;
        }
        return f.a.y.a.E(this.f4188b, ((q) obj).f4187e);
    }

    @Override // java.util.Collection
    public boolean containsAll(Collection<? extends Object> collection) {
        g.h0.c.l.f(collection, "elements");
        byte[] bArr = this.f4188b;
        g.h0.c.l.f(collection, "elements");
        if (!collection.isEmpty()) {
            for (Object obj : collection) {
                if (!((obj instanceof q) && f.a.y.a.E(bArr, ((q) obj).f4187e))) {
                    return false;
                }
            }
        }
        return true;
    }

    @Override // java.util.Collection
    public boolean equals(Object obj) {
        return (obj instanceof r) && g.h0.c.l.a(this.f4188b, ((r) obj).f4188b);
    }

    @Override // java.util.Collection
    public int hashCode() {
        return Arrays.hashCode(this.f4188b);
    }

    @Override // java.util.Collection
    public boolean isEmpty() {
        return this.f4188b.length == 0;
    }

    @Override // java.util.Collection, java.lang.Iterable
    public Iterator<q> iterator() {
        return new a(this.f4188b);
    }

    @Override // java.util.Collection
    public boolean remove(Object obj) {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.Collection
    public boolean removeAll(Collection<? extends Object> collection) {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.Collection
    public boolean retainAll(Collection<? extends Object> collection) {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.Collection
    public int size() {
        return this.f4188b.length;
    }

    @Override // java.util.Collection
    public Object[] toArray() {
        return g.h0.c.f.a(this);
    }

    @Override // java.util.Collection
    public <T> T[] toArray(T[] tArr) {
        g.h0.c.l.f(tArr, "array");
        return (T[]) g.h0.c.f.b(this, tArr);
    }

    public String toString() {
        byte[] bArr = this.f4188b;
        StringBuilder sbB = d.b.a.a.a.B("UByteArray(storage=");
        sbB.append(Arrays.toString(bArr));
        sbB.append(')');
        return sbB.toString();
    }
}
