@SuppressWarnings("ConstantConditions") @Test public void testFromAlphabeticCollection() { final AlphabeticHeaders.ModuleAdapter mockAdapter = mock(AlphabeticHeaders.ModuleAdapter.class); final Module module = new Module(); module.attachToAdapter(mockAdapter); final List<AlphabeticHeaders.AlphabeticItem> items = createItems(); module.fromAlphabeticCollection(items); assertThat(module.size(), is(10)); final List<String> headerTexts = new ArrayList<>(module.size()); for (int i = 0; i < items.size() + module.size(); i++) { if (module.isHeaderAt(i)) { final HeadersModule.Header header = module.getHeader(i); final String headerText = header.toString(); assertThat(headerTexts.contains(headerText), is(false)); headerTexts.add(headerText); } } verify(mockAdapter).notifyDataSetChanged(); verifyNoMoreInteractions(mockAdapter); }
public <Item extends AlphabeticItem> void fromAlphabeticCollection(@NonNull final Collection<Item> collection) { clearHeaders(); if (!collection.isEmpty()) { int position = 0; for (final Item item : collection) { onProcessItem(position++, item); } } notifyAdapter(); }
AlphabeticHeaders extends HeadersModule<VH, HeadersModule.SimpleHeader> { public <Item extends AlphabeticItem> void fromAlphabeticCollection(@NonNull final Collection<Item> collection) { clearHeaders(); if (!collection.isEmpty()) { int position = 0; for (final Item item : collection) { onProcessItem(position++, item); } } notifyAdapter(); } }
AlphabeticHeaders extends HeadersModule<VH, HeadersModule.SimpleHeader> { public <Item extends AlphabeticItem> void fromAlphabeticCollection(@NonNull final Collection<Item> collection) { clearHeaders(); if (!collection.isEmpty()) { int position = 0; for (final Item item : collection) { onProcessItem(position++, item); } } notifyAdapter(); }  }
AlphabeticHeaders extends HeadersModule<VH, HeadersModule.SimpleHeader> { public <Item extends AlphabeticItem> void fromAlphabeticCollection(@NonNull final Collection<Item> collection) { clearHeaders(); if (!collection.isEmpty()) { int position = 0; for (final Item item : collection) { onProcessItem(position++, item); } } notifyAdapter(); }  void fromAlphabeticCursor(@NonNull final C cursor); void fromAlphabeticCollection(@NonNull final Collection<Item> collection); @Override @CallSuper void clearHeaders(); }
AlphabeticHeaders extends HeadersModule<VH, HeadersModule.SimpleHeader> { public <Item extends AlphabeticItem> void fromAlphabeticCollection(@NonNull final Collection<Item> collection) { clearHeaders(); if (!collection.isEmpty()) { int position = 0; for (final Item item : collection) { onProcessItem(position++, item); } } notifyAdapter(); }  void fromAlphabeticCursor(@NonNull final C cursor); void fromAlphabeticCollection(@NonNull final Collection<Item> collection); @Override @CallSuper void clearHeaders();  }