package com.google.common.collect; import com.google.common.collect.Ordering; import java.io.Serializable; import java.util.List; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class ExplicitOrdering extends Ordering implements Serializable { private static final long serialVersionUID = 0; final ImmutableMap rankMap; /* JADX INFO: Access modifiers changed from: package-private */ public ExplicitOrdering(List list) { this(Maps.indexMap(list)); } ExplicitOrdering(ImmutableMap immutableMap) { this.rankMap = immutableMap; } @Override // com.google.common.collect.Ordering, java.util.Comparator public final int compare(T t, T t2) { return rank(t) - rank(t2); } private int rank(T t) { Integer num = this.rankMap.get(t); if (num == null) { throw new Ordering.IncomparableValueException(t); } return num.intValue(); } @Override // java.util.Comparator public final boolean equals(Object obj) { if (obj instanceof ExplicitOrdering) { return this.rankMap.equals(((ExplicitOrdering) obj).rankMap); } return false; } public final int hashCode() { return this.rankMap.hashCode(); } public final String toString() { String valueOf = String.valueOf(this.rankMap.keySet()); StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 19); sb.append("Ordering.explicit("); sb.append(valueOf); sb.append(")"); return sb.toString(); } }