@Test public void testCountHeadersBeforePositionOnEmptyHeaders() { final TestModule module = new TestModule(); for (int i = 0; i < 10; i++) { assertThat(module.countHeadersBeforePosition(i), is(0)); } }
public int countHeadersBeforePosition(final int position) { int count = 0; for (int i = 0; i < headers.size(); i++) { if (headers.keyAt(i) < position) { count++; } else { break; } } return count; }
HeadersModule extends AdapterModule { public int countHeadersBeforePosition(final int position) { int count = 0; for (int i = 0; i < headers.size(); i++) { if (headers.keyAt(i) < position) { count++; } else { break; } } return count; } }
HeadersModule extends AdapterModule { public int countHeadersBeforePosition(final int position) { int count = 0; for (int i = 0; i < headers.size(); i++) { if (headers.keyAt(i) < position) { count++; } else { break; } } return count; }  }
HeadersModule extends AdapterModule { public int countHeadersBeforePosition(final int position) { int count = 0; for (int i = 0; i < headers.size(); i++) { if (headers.keyAt(i) < position) { count++; } else { break; } } return count; }  boolean isEmpty(); int size(); boolean isHeaderAt(final int position); @Nullable H getHeader(final int position); @NonNull SparseArray<H> getHeaders(); void clearHeaders(); int correctPosition(final int position); int countHeadersBeforePosition(final int position); void setHeaderStyleAttr(@AttrRes final int styleAttr); @AttrRes int getHeaderStyleAttr(); @NonNull abstract VH createViewHolder(@NonNull ViewGroup parent, int viewType); @NonNull final SimpleHeaderHolder createSimpleHeaderHolder(@NonNull ViewGroup parent); abstract void bindViewHolder(@NonNull VH viewHolder, int position); }
HeadersModule extends AdapterModule { public int countHeadersBeforePosition(final int position) { int count = 0; for (int i = 0; i < headers.size(); i++) { if (headers.keyAt(i) < position) { count++; } else { break; } } return count; }  boolean isEmpty(); int size(); boolean isHeaderAt(final int position); @Nullable H getHeader(final int position); @NonNull SparseArray<H> getHeaders(); void clearHeaders(); int correctPosition(final int position); int countHeadersBeforePosition(final int position); void setHeaderStyleAttr(@AttrRes final int styleAttr); @AttrRes int getHeaderStyleAttr(); @NonNull abstract VH createViewHolder(@NonNull ViewGroup parent, int viewType); @NonNull final SimpleHeaderHolder createSimpleHeaderHolder(@NonNull ViewGroup parent); abstract void bindViewHolder(@NonNull VH viewHolder, int position);  }