30 lines
929 B
Java
30 lines
929 B
Java
|
package com.huawei.hms.common.data;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Arrays;
|
||
|
import java.util.Iterator;
|
||
|
import org.simpleframework.xml.core.FieldScanner;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class FreezableUtils {
|
||
|
public static <T, E extends Freezable<T>> ArrayList<T> freeze(ArrayList<E> arrayList) {
|
||
|
return freezeIterable(arrayList);
|
||
|
}
|
||
|
|
||
|
public static <T, E extends Freezable<T>> ArrayList<T> freezeIterable(Iterable<E> iterable) {
|
||
|
FieldScanner fieldScanner = (ArrayList<T>) new ArrayList();
|
||
|
if (iterable == null) {
|
||
|
return fieldScanner;
|
||
|
}
|
||
|
Iterator<E> it = iterable.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
fieldScanner.add(it.next().freeze());
|
||
|
}
|
||
|
return fieldScanner;
|
||
|
}
|
||
|
|
||
|
public static <T, E extends Freezable<T>> ArrayList<T> freeze(E[] eArr) {
|
||
|
return freezeIterable(Arrays.asList(eArr));
|
||
|
}
|
||
|
}
|