@Provides
  @Singleton
  Map<String, HealthDependency> provideHealthDependencyMap(
      Set<HealthDependency> healthDependencySet) {
    Map<String, HealthDependency> result = Maps.newHashMap();
    for (HealthDependency dependency : healthDependencySet) {
      if (result.containsKey(dependency.getName())) {
        throw new IllegalStateException(
            "Dependency name " + dependency.getName() + " is used by both "
                + dependency.getName() + " and " + result.get(dependency.getName()));
      }
      result.put(dependency.getName(), dependency);
    }
    return ImmutableMap.copyOf(result);
  }
@ Provides @ Singleton Map < String , HealthDependency > provideHealthDependencyMap ( Set < HealthDependency > healthDependencySet ) { Map < String , HealthDependency > result = Maps . newHashMap ( ) ; for ( HealthDependency dependency : healthDependencySet ) { if ( result . containsKey ( dependency . getName ( ) ) ) { throw new IllegalStateException ( "Dependency name " + dependency . getName ( ) + " is used by both " + dependency . getName ( ) + " and " + result . get ( dependency . getName ( ) ) ) ; } result . put ( dependency . getName ( ) , dependency ) ; } return ImmutableMap . copyOf ( result ) ; }
Convert a Set of HealthDependency instances into a Map of them keyed by dependency name.

<p>Fails fast if there are duplicate names.