package d;

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 */
@n
public final class x implements Collection<w> {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final byte[] f2739c;

    /* JADX INFO: compiled from: UByteArray.kt */
    @n
    private static final class a implements Iterator<w> {

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        private final byte[] f2740c;

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

        public a(byte[] bArr) {
            d.n0.c.s.e(bArr, "array");
            this.f2740c = bArr;
        }

        public byte a() {
            int i = this.f2741d;
            byte[] bArr = this.f2740c;
            if (i >= bArr.length) {
                throw new NoSuchElementException(String.valueOf(this.f2741d));
            }
            this.f2741d = i + 1;
            return w.b(bArr[i]);
        }

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

        @Override // java.util.Iterator
        public /* bridge */ /* synthetic */ w next() {
            return w.a(a());
        }

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

    private /* synthetic */ x(byte[] bArr) {
        this.f2739c = bArr;
    }

    public static final /* synthetic */ x a(byte[] bArr) {
        return new x(bArr);
    }

    public static byte[] b(int i) {
        return c(new byte[i]);
    }

    public static byte[] c(byte[] bArr) {
        d.n0.c.s.e(bArr, "storage");
        return bArr;
    }

    public static boolean e(byte[] bArr, byte b2) {
        return d.j0.j.f(bArr, b2);
    }

    public static boolean f(byte[] bArr, Collection<w> collection) {
        d.n0.c.s.e(collection, "elements");
        if (!collection.isEmpty()) {
            for (Object obj : collection) {
                if (!((obj instanceof w) && d.j0.j.f(bArr, ((w) obj).f()))) {
                    return false;
                }
            }
        }
        return true;
    }

    public static boolean g(byte[] bArr, Object obj) {
        return (obj instanceof x) && d.n0.c.s.a(bArr, ((x) obj).p());
    }

    public static final byte h(byte[] bArr, int i) {
        return w.b(bArr[i]);
    }

    public static int j(byte[] bArr) {
        return bArr.length;
    }

    public static int k(byte[] bArr) {
        return Arrays.hashCode(bArr);
    }

    public static boolean l(byte[] bArr) {
        return bArr.length == 0;
    }

    public static Iterator<w> m(byte[] bArr) {
        return new a(bArr);
    }

    public static final void n(byte[] bArr, int i, byte b2) {
        bArr[i] = b2;
    }

    public static String o(byte[] bArr) {
        return "UByteArray(storage=" + Arrays.toString(bArr) + ')';
    }

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

    @Override // java.util.Collection
    public boolean addAll(Collection<? extends w> 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 /* bridge */ boolean contains(Object obj) {
        if (obj instanceof w) {
            return d(((w) obj).f());
        }
        return false;
    }

    @Override // java.util.Collection
    public boolean containsAll(Collection<? extends Object> collection) {
        d.n0.c.s.e(collection, "elements");
        return f(this.f2739c, collection);
    }

    public boolean d(byte b2) {
        return e(this.f2739c, b2);
    }

    @Override // java.util.Collection
    public boolean equals(Object obj) {
        return g(this.f2739c, obj);
    }

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

    @Override // java.util.Collection
    /* JADX INFO: renamed from: i, reason: merged with bridge method [inline-methods] */
    public int size() {
        return j(this.f2739c);
    }

    @Override // java.util.Collection
    public boolean isEmpty() {
        return l(this.f2739c);
    }

    @Override // java.util.Collection, java.lang.Iterable
    public Iterator<w> iterator() {
        return m(this.f2739c);
    }

    public final /* synthetic */ byte[] p() {
        return this.f2739c;
    }

    @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 Object[] toArray() {
        return d.n0.c.k.a(this);
    }

    @Override // java.util.Collection
    public <T> T[] toArray(T[] tArr) {
        d.n0.c.s.e(tArr, "array");
        return (T[]) d.n0.c.k.b(this, tArr);
    }

    public String toString() {
        return o(this.f2739c);
    }
}
