package FSaI4_7.IFxWkV_5;

import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
/* compiled from: _Collections.kt */
/* loaded from: classes.dex */
public class LGe8pk_15 extends YghfZG_14 {
    public static final <T> T KQgRr5e_0(Iterable<? extends T> iterable) {
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(iterable, "$receiver");
        if (iterable instanceof List) {
            return (T) KQgRr5e_0((List<? extends Object>) iterable);
        }
        Iterator<? extends T> it = iterable.iterator();
        if (it.hasNext()) {
            T next = it.next();
            if (it.hasNext()) {
                throw new IllegalArgumentException("Collection has more than one element.");
            }
            return next;
        }
        throw new NoSuchElementException("Collection is empty.");
    }

    public static final <T> T KQgRr5e_0(List<? extends T> list) {
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(list, "$receiver");
        int size = list.size();
        if (size != 0) {
            if (size == 1) {
                return list.get(0);
            }
            throw new IllegalArgumentException("List has more than one element.");
        }
        throw new NoSuchElementException("List is empty.");
    }
}
