TypedIndexedObjectContainer implements ObjectIndexProvider { public void add( @Nonnull IdentifiableObject identifiableObject ) { getTypedContainer( identifiableObject.getClass() ).add( identifiableObject ); }  @Nonnull IndexedObjectContainer getTypedContainer( @Nonnull Class<? extends IdentifiableObject> c ); @Nonnull @Override Integer mergeObjectIndex( @Nonnull IdentifiableObject object ); boolean containsObject( @Nonnull IdentifiableObject object ); void add( @Nonnull IdentifiableObject identifiableObject );  }
@Test public void add() { final Attribute attribute1 = new Attribute(); final Attribute attribute2 = new Attribute(); final Attribute attribute3 = new Attribute(); final Category category1 = new Category(); final Category category2 = new Category(); container.add( attribute1 ); container.add( attribute2 ); container.add( attribute3 ); container.add( category1 ); container.add( category2 ); Assert.assertEquals( (Integer) 0, container.mergeObjectIndex( attribute1 ) ); Assert.assertEquals( (Integer) 1, container.mergeObjectIndex( attribute2 ) ); Assert.assertEquals( (Integer) 2, container.mergeObjectIndex( attribute3 ) ); Assert.assertEquals( (Integer) 0, container.mergeObjectIndex( category1 ) ); Assert.assertEquals( (Integer) 1, container.mergeObjectIndex( category2 ) ); }