package com.google.protobuf;

import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.RandomAccess;

/* loaded from: classes3.dex */
public class f0 extends c implements g0, RandomAccess {

    /* renamed from: r, reason: collision with root package name */
    private static final f0 f15024r;

    /* renamed from: s, reason: collision with root package name */
    public static final g0 f15025s;

    /* renamed from: q, reason: collision with root package name */
    private final List f15026q;

    static {
        f0 f0Var = new f0(false);
        f15024r = f0Var;
        f15025s = f0Var;
    }

    private f0(boolean z10) {
        super(z10);
        this.f15026q = Collections.emptyList();
    }

    private static String i(Object obj) {
        return obj instanceof String ? (String) obj : obj instanceof h ? ((h) obj).H() : z.j((byte[]) obj);
    }

    @Override // com.google.protobuf.c, java.util.AbstractCollection, java.util.Collection, java.util.List
    public boolean addAll(Collection collection) {
        return addAll(size(), collection);
    }

    @Override // com.google.protobuf.g0
    public List b() {
        return Collections.unmodifiableList(this.f15026q);
    }

    @Override // com.google.protobuf.g0
    public g0 c() {
        return h() ? new r1(this) : this;
    }

    @Override // com.google.protobuf.c, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
    public void clear() {
        e();
        this.f15026q.clear();
        ((AbstractList) this).modCount++;
    }

    @Override // com.google.protobuf.c, java.util.AbstractList, java.util.Collection, java.util.List
    public /* bridge */ /* synthetic */ boolean equals(Object obj) {
        return super.equals(obj);
    }

    @Override // com.google.protobuf.g0
    public Object f(int i10) {
        return this.f15026q.get(i10);
    }

    @Override // java.util.AbstractList, java.util.List
    /* renamed from: g, reason: merged with bridge method [inline-methods] */
    public void add(int i10, String str) {
        e();
        this.f15026q.add(i10, str);
        ((AbstractList) this).modCount++;
    }

    @Override // com.google.protobuf.c, com.google.protobuf.z.j
    public /* bridge */ /* synthetic */ boolean h() {
        return super.h();
    }

    @Override // com.google.protobuf.c, java.util.AbstractList, java.util.Collection, java.util.List
    public /* bridge */ /* synthetic */ int hashCode() {
        return super.hashCode();
    }

    @Override // java.util.AbstractList, java.util.List
    /* renamed from: k, reason: merged with bridge method [inline-methods] */
    public String get(int i10) {
        Object obj = this.f15026q.get(i10);
        if (obj instanceof String) {
            return (String) obj;
        }
        if (obj instanceof h) {
            h hVar = (h) obj;
            String H = hVar.H();
            if (hVar.s()) {
                this.f15026q.set(i10, H);
            }
            return H;
        }
        byte[] bArr = (byte[]) obj;
        String j10 = z.j(bArr);
        if (z.g(bArr)) {
            this.f15026q.set(i10, j10);
        }
        return j10;
    }

    @Override // com.google.protobuf.z.j
    /* renamed from: l, reason: merged with bridge method [inline-methods] */
    public f0 a(int i10) {
        if (i10 < size()) {
            throw new IllegalArgumentException();
        }
        ArrayList arrayList = new ArrayList(i10);
        arrayList.addAll(this.f15026q);
        return new f0(arrayList);
    }

    @Override // com.google.protobuf.c, java.util.AbstractList, java.util.List
    /* renamed from: m, reason: merged with bridge method [inline-methods] */
    public String remove(int i10) {
        e();
        Object remove = this.f15026q.remove(i10);
        ((AbstractList) this).modCount++;
        return i(remove);
    }

    @Override // java.util.AbstractList, java.util.List
    /* renamed from: n, reason: merged with bridge method [inline-methods] */
    public String set(int i10, String str) {
        e();
        return i(this.f15026q.set(i10, str));
    }

    @Override // com.google.protobuf.c, java.util.AbstractCollection, java.util.Collection, java.util.List
    public /* bridge */ /* synthetic */ boolean removeAll(Collection collection) {
        return super.removeAll(collection);
    }

    @Override // com.google.protobuf.c, java.util.AbstractCollection, java.util.Collection, java.util.List
    public /* bridge */ /* synthetic */ boolean retainAll(Collection collection) {
        return super.retainAll(collection);
    }

    @Override // java.util.AbstractCollection, java.util.Collection, java.util.List
    public int size() {
        return this.f15026q.size();
    }

    @Override // com.google.protobuf.g0
    public void y(h hVar) {
        e();
        this.f15026q.add(hVar);
        ((AbstractList) this).modCount++;
    }

    @Override // com.google.protobuf.c, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
    public /* bridge */ /* synthetic */ boolean add(Object obj) {
        return super.add(obj);
    }

    @Override // com.google.protobuf.c, java.util.AbstractList, java.util.List
    public boolean addAll(int i10, Collection collection) {
        e();
        if (collection instanceof g0) {
            collection = ((g0) collection).b();
        }
        boolean addAll = this.f15026q.addAll(i10, collection);
        ((AbstractList) this).modCount++;
        return addAll;
    }

    @Override // com.google.protobuf.c, java.util.AbstractCollection, java.util.Collection, java.util.List
    public /* bridge */ /* synthetic */ boolean remove(Object obj) {
        return super.remove(obj);
    }

    public f0(int i10) {
        this(new ArrayList(i10));
    }

    private f0(ArrayList arrayList) {
        this.f15026q = arrayList;
    }
}
