package com.google.common.collect; import java.io.Serializable; import java.util.Arrays; import java.util.Comparator; import javax.annotation.CheckForNull; @ElementTypesAreNonnullByDefault /* loaded from: classes3.dex */ final class CompoundOrdering extends Ordering implements Serializable { private static final long serialVersionUID = 0; final Comparator[] comparators; /* JADX INFO: Access modifiers changed from: package-private */ public CompoundOrdering(Comparator comparator, Comparator comparator2) { this.comparators = new Comparator[]{comparator, comparator2}; } /* JADX INFO: Access modifiers changed from: package-private */ public CompoundOrdering(Iterable> iterable) { this.comparators = (Comparator[]) Iterables.toArray(iterable, new Comparator[0]); } @Override // com.google.common.collect.Ordering, java.util.Comparator public int compare(@ParametricNullness T t, @ParametricNullness T t2) { int i = 0; while (true) { Comparator[] comparatorArr = this.comparators; if (i >= comparatorArr.length) { return 0; } int compare = comparatorArr[i].compare(t, t2); if (compare != 0) { return compare; } i++; } } @Override // java.util.Comparator public boolean equals(@CheckForNull Object obj) { if (obj == this) { return true; } if (obj instanceof CompoundOrdering) { return Arrays.equals(this.comparators, ((CompoundOrdering) obj).comparators); } return false; } public int hashCode() { return Arrays.hashCode(this.comparators); } public String toString() { String arrays = Arrays.toString(this.comparators); return new StringBuilder(String.valueOf(arrays).length() + 19).append("Ordering.compound(").append(arrays).append(")").toString(); } }