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 Comparator comparator(SortedSet sortedSet) { Comparator comparator = sortedSet.comparator(); return comparator == null ? Ordering.natural() : comparator; } }