package com.google.android.gms.internal.vision; import com.google.android.gms.internal.vision.zzec; import com.google.android.gms.internal.vision.zzed; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; /* loaded from: classes2.dex */ public abstract class zzec, BuilderType extends zzed> implements zzhf { private static boolean zzrj = false; protected int zzri = 0; @Override // com.google.android.gms.internal.vision.zzhf public final zzeo zzce() { try { zzev zzaj = zzeo.zzaj(zzeq()); zzb(zzaj.zzdp()); return zzaj.zzdo(); } catch (IOException e) { String name = getClass().getName(); StringBuilder sb = new StringBuilder(String.valueOf(name).length() + 72); sb.append("Serializing "); sb.append(name); sb.append(" to a ByteString threw an IOException (should never happen)."); throw new RuntimeException(sb.toString(), e); } } public final byte[] toByteArray() { try { byte[] bArr = new byte[zzeq()]; zzfe zzg = zzfe.zzg(bArr); zzb(zzg); zzg.zzea(); return bArr; } catch (IOException e) { String name = getClass().getName(); StringBuilder sb = new StringBuilder(String.valueOf(name).length() + 72); sb.append("Serializing "); sb.append(name); sb.append(" to a byte array threw an IOException (should never happen)."); throw new RuntimeException(sb.toString(), e); } } /* JADX INFO: Access modifiers changed from: package-private */ public int zzcf() { throw new UnsupportedOperationException(); } /* JADX INFO: Access modifiers changed from: package-private */ public void zzy(int i) { throw new UnsupportedOperationException(); } protected static void zza(Iterable iterable, List list) { zzga.checkNotNull(iterable); if (iterable instanceof zzgo) { List zzft = ((zzgo) iterable).zzft(); zzgo zzgoVar = (zzgo) list; int size = list.size(); for (Object obj : zzft) { if (obj == null) { int size2 = zzgoVar.size(); StringBuilder sb = new StringBuilder(37); sb.append("Element at index "); sb.append(size2 - size); sb.append(" is null."); String sb2 = sb.toString(); for (int size3 = zzgoVar.size() - 1; size3 >= size; size3--) { zzgoVar.remove(size3); } throw new NullPointerException(sb2); } if (obj instanceof zzeo) { zzgoVar.zzc((zzeo) obj); } else { zzgoVar.add((String) obj); } } return; } if (iterable instanceof zzhr) { list.addAll((Collection) iterable); return; } if ((list instanceof ArrayList) && (iterable instanceof Collection)) { ((ArrayList) list).ensureCapacity(list.size() + ((Collection) iterable).size()); } int size4 = list.size(); for (T t : iterable) { if (t == null) { int size5 = list.size(); StringBuilder sb3 = new StringBuilder(37); sb3.append("Element at index "); sb3.append(size5 - size4); sb3.append(" is null."); String sb4 = sb3.toString(); for (int size6 = list.size() - 1; size6 >= size4; size6--) { list.remove(size6); } throw new NullPointerException(sb4); } list.add(t); } } }