title: Dagger 2 Injector and Binds IntoMap with IntKey
body: <p>I'm using <code>Dagger 2</code> Android injector to inject my <code>Activities</code> and <code>Fragments</code>. </p>
  
  <p>I have a generic <code>RecyclerView</code> Adapter and keeping <code>ViewHolderFactories</code> and <code>Binders</code> in a <code>Map</code>.</p>
  
  <p>Here's my adapter:</p>
  
  <pre><code>@Module
  class CorePresentationModule {
  
      @Provides
      fun provideDisplayItemComperator(): DisplayItemComperator = DefaultDisplayItemComperator()
  
      @Module
      companion object {
          @JvmStatic
          @Provides
          fun provideRecyclerAdapter(
              itemComparator: DisplayItemComperator,
              factoryMap: Map&lt;Int, @JvmSuppressWildcards ViewHolderFactory&gt;,
              binderMap: Map&lt;Int, @JvmSuppressWildcards ViewHolderBinder&gt;,
              androidPreconditions: AndroidPreconditions
          ): RecyclerViewAdapter {
              return RecyclerViewAdapter(
                  itemComperator = itemComparator,
                  viewHolderFactoryMap = factoryMap,
                  viewBinderFactoryMap = binderMap,
                  androidPreconditions = androidPreconditions
              )
          }
      }
  }
  </code></pre>
  
  <p>I crate a presentation module for my Fragment like the following:</p>
  
  <pre><code>@Module
  abstract class MessagesPresentationModule {
  
      @Binds
      @IntoMap
      @IntKey(MESSAGE)
      internal abstract fun provideMessagesViewModelFactory(factory: MessagesViewHolder.MessageViewHolderFactory): ViewHolderFactory
  
      @Binds
      @IntoMap
      @IntKey(MESSAGE)
      internal abstract fun provideMessagesViewHolderBinder(binder: MessagesViewHolder.MessagesViewHolderBinder): ViewHolderBinder
  
  } 
  </code></pre>
  
  <p>In another fragment i inject my adapter again and create another module for my screen:</p>
  
  <pre><code>@Module
  abstract class LinksPresentationModule {
  
      @Binds
      @IntoMap
      @IntKey(LINK)
      internal abstract fun provideLinksViewModelFactory(factory: LinksViewHolder.LinksViewHolderFactory): ViewHolderFactory
  
      @Binds
      @IntoMap
      @IntKey(LINK)
      internal abstract fun provideLinksViewHolderBinder(binder: LinksViewHolder.LinksViewHolderBinder): ViewHolderBinder
  
  }
  </code></pre>
  
  <p>When <code>MESSAGE</code> and <code>LINK</code> is 0 i get a compile error </p>
  
  <blockquote>
    <p>The same map key is bound more than once for <code>ViewHolderFactory</code></p>
  </blockquote>
  
  <p>What's is the best solution to get avoid this execpt putting all <code>IntKeys</code> in a constants class with ordered and incremented?</p>
  
  <p>Thanks.</p>