package com.google.common.collect; import java.io.Serializable; import java.util.Arrays; import java.util.Comparator; /* loaded from: classes2.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 final int compare(T t, 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 final boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof CompoundOrdering) { return Arrays.equals(this.comparators, ((CompoundOrdering) obj).comparators); } return false; } public final int hashCode() { return Arrays.hashCode(this.comparators); } public final String toString() { String arrays = Arrays.toString(this.comparators); StringBuilder sb = new StringBuilder(String.valueOf(arrays).length() + 19); sb.append("Ordering.compound("); sb.append(arrays); sb.append(")"); return sb.toString(); } }