package io.grpc; import com.google.common.base.Preconditions; import io.grpc.Attributes; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.net.SocketAddress; import java.util.ArrayList; import java.util.Collections; import java.util.List; /* loaded from: classes6.dex */ public final class EquivalentAddressGroup { public static final Attributes.Key ATTR_AUTHORITY_OVERRIDE = Attributes.Key.create("io.grpc.EquivalentAddressGroup.authorityOverride"); private final List addrs; private final Attributes attrs; private final int hashCode; @Documented @Retention(RetentionPolicy.SOURCE) /* loaded from: classes.dex */ public @interface Attr { } public EquivalentAddressGroup(List list) { this(list, Attributes.EMPTY); } public EquivalentAddressGroup(List list, Attributes attributes) { Preconditions.checkArgument(!list.isEmpty(), "addrs is empty"); List unmodifiableList = Collections.unmodifiableList(new ArrayList(list)); this.addrs = unmodifiableList; this.attrs = (Attributes) Preconditions.checkNotNull(attributes, "attrs"); this.hashCode = unmodifiableList.hashCode(); } public EquivalentAddressGroup(SocketAddress socketAddress) { this(socketAddress, Attributes.EMPTY); } public EquivalentAddressGroup(SocketAddress socketAddress, Attributes attributes) { this((List) Collections.singletonList(socketAddress), attributes); } public final String toString() { StringBuilder sb = new StringBuilder("["); sb.append(this.addrs); sb.append("/"); sb.append(this.attrs); sb.append("]"); return sb.toString(); } public final boolean equals(Object obj) { if (!(obj instanceof EquivalentAddressGroup)) { return false; } EquivalentAddressGroup equivalentAddressGroup = (EquivalentAddressGroup) obj; if (this.addrs.size() != equivalentAddressGroup.addrs.size()) { return false; } for (int i = 0; i < this.addrs.size(); i++) { if (!this.addrs.get(i).equals(equivalentAddressGroup.addrs.get(i))) { return false; } } return this.attrs.equals(equivalentAddressGroup.attrs); } public final int hashCode() { return this.hashCode; } public final Attributes getAttributes() { return this.attrs; } public final List getAddresses() { return this.addrs; } }