package p009c1;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import p006b1.C0475e;
import p006b1.C0481i;
import p039m1.C1470g;

/* renamed from: c1.o */
/* loaded from: classes.dex */
public class C0510o extends C0509n {
    /* renamed from: h */
    public static final <T, C extends Collection<? super T>> C m3603h(Iterable<? extends T> iterable, C c) {
        C1470g.m1292e(iterable, "<this>");
        C1470g.m1292e(c, "destination");
        for (T t : iterable) {
            c.add(t);
        }
        return c;
    }

    /* renamed from: i */
    public static final <T> List<T> m3602i(Iterable<? extends T> iterable) {
        C1470g.m1292e(iterable, "<this>");
        if (iterable instanceof Collection) {
            Collection collection = (Collection) iterable;
            int size = collection.size();
            if (size != 0) {
                if (size != 1) {
                    return m3600k(collection);
                }
                return C0501f.m3610a(iterable instanceof List ? ((List) iterable).get(0) : iterable.iterator().next());
            }
            return C0502g.m3609b();
        }
        return C0502g.m3607d(m3601j(iterable));
    }

    /* renamed from: j */
    public static final <T> List<T> m3601j(Iterable<? extends T> iterable) {
        C1470g.m1292e(iterable, "<this>");
        return iterable instanceof Collection ? m3600k((Collection) iterable) : (List) m3603h(iterable, new ArrayList());
    }

    /* renamed from: k */
    public static final <T> List<T> m3600k(Collection<? extends T> collection) {
        C1470g.m1292e(collection, "<this>");
        return new ArrayList(collection);
    }

    /* renamed from: l */
    public static final <T> Set<T> m3599l(Iterable<? extends T> iterable) {
        C1470g.m1292e(iterable, "<this>");
        if (iterable instanceof Collection) {
            Collection collection = (Collection) iterable;
            int size = collection.size();
            if (size != 0) {
                if (size != 1) {
                    return (Set) m3603h(iterable, new LinkedHashSet(C0517v.m3581a(collection.size())));
                }
                return C0519x.m3571a(iterable instanceof List ? ((List) iterable).get(0) : iterable.iterator().next());
            }
            return C0520y.m3570b();
        }
        return C0520y.m3569c((Set) m3603h(iterable, new LinkedHashSet()));
    }

    /* renamed from: m */
    public static final <T, R> List<C0475e<T, R>> m3598m(Iterable<? extends T> iterable, Iterable<? extends R> iterable2) {
        C1470g.m1292e(iterable, "<this>");
        C1470g.m1292e(iterable2, "other");
        Iterator<? extends T> it = iterable.iterator();
        Iterator<? extends R> it2 = iterable2.iterator();
        ArrayList arrayList = new ArrayList(Math.min(C0503h.m3605f(iterable, 10), C0503h.m3605f(iterable2, 10)));
        while (it.hasNext() && it2.hasNext()) {
            arrayList.add(C0481i.m3620a(it.next(), it2.next()));
        }
        return arrayList;
    }
}