package io.grpc.internal; import io.grpc.HandlerRegistry; import io.grpc.ServerMethodDefinition; import io.grpc.ServerServiceDefinition; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /* loaded from: classes6.dex */ final class InternalHandlerRegistry extends HandlerRegistry { private final Map> methods; private final List services; private InternalHandlerRegistry(List list, Map> map) { this.services = list; this.methods = map; } @Override // io.grpc.HandlerRegistry public final ServerMethodDefinition lookupMethod(String str, String str2) { return this.methods.get(str); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes6.dex */ public static final class Builder { private final HashMap services = new LinkedHashMap(); /* JADX INFO: Access modifiers changed from: package-private */ public final Builder addService(ServerServiceDefinition serverServiceDefinition) { this.services.put(serverServiceDefinition.getServiceDescriptor().getName(), serverServiceDefinition); return this; } /* JADX INFO: Access modifiers changed from: package-private */ public final InternalHandlerRegistry build() { HashMap hashMap = new HashMap(); Iterator it = this.services.values().iterator(); while (it.hasNext()) { for (ServerMethodDefinition serverMethodDefinition : it.next().getMethods()) { hashMap.put(serverMethodDefinition.getMethodDescriptor().getFullMethodName(), serverMethodDefinition); } } return new InternalHandlerRegistry(Collections.unmodifiableList(new ArrayList(this.services.values())), Collections.unmodifiableMap(hashMap)); } } @Override // io.grpc.HandlerRegistry public final List getServices() { return this.services; } }