33 lines
1.1 KiB
Java
33 lines
1.1 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import java.util.Comparator;
|
|
import java.util.SortedSet;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public final class SortedIterables {
|
|
private SortedIterables() {
|
|
}
|
|
|
|
public static boolean hasSameComparator(Comparator<?> comparator, Iterable<?> iterable) {
|
|
Comparator comparator2;
|
|
Preconditions.checkNotNull(comparator);
|
|
Preconditions.checkNotNull(iterable);
|
|
if (iterable instanceof SortedSet) {
|
|
comparator2 = comparator((SortedSet) iterable);
|
|
} else {
|
|
if (!(iterable instanceof SortedIterable)) {
|
|
return false;
|
|
}
|
|
comparator2 = ((SortedIterable) iterable).comparator();
|
|
}
|
|
return comparator.equals(comparator2);
|
|
}
|
|
|
|
public static <E> Comparator<? super E> comparator(SortedSet<E> sortedSet) {
|
|
Comparator<? super E> comparator = sortedSet.comparator();
|
|
return comparator == null ? Ordering.natural() : comparator;
|
|
}
|
|
}
|