40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
package ra;
|
|
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.NoSuchElementException;
|
|
/* compiled from: Iterables.java */
|
|
/* loaded from: classes4.dex */
|
|
public final class x {
|
|
private static <E> Collection<E> a(Iterable<E> iterable) {
|
|
return iterable instanceof Collection ? (Collection) iterable : a0.g(iterable.iterator());
|
|
}
|
|
|
|
public static <T> T b(Iterable<? extends T> iterable, T t10) {
|
|
return (T) y.h(iterable.iterator(), t10);
|
|
}
|
|
|
|
public static <T> T c(Iterable<T> iterable) {
|
|
if (!(iterable instanceof List)) {
|
|
return (T) y.g(iterable.iterator());
|
|
}
|
|
List list = (List) iterable;
|
|
if (!list.isEmpty()) {
|
|
return (T) d(list);
|
|
}
|
|
throw new NoSuchElementException();
|
|
}
|
|
|
|
private static <T> T d(List<T> list) {
|
|
return list.get(list.size() - 1);
|
|
}
|
|
|
|
static Object[] e(Iterable<?> iterable) {
|
|
return a(iterable).toArray();
|
|
}
|
|
|
|
public static String f(Iterable<?> iterable) {
|
|
return y.l(iterable.iterator());
|
|
}
|
|
}
|