@Test public void testSelect() { final SelectionModule module = new SelectionModule(); module.select(1L); assertThat(module.isSelected(1L), is(true)); }
protected final void select(final long id) { if (selection == null) selection = new ArrayList<>(mode == SINGLE ? INITIAL_CAPACITY_SINGLE : INITIAL_CAPACITY_MULTI); if (!selection.contains(id)) selection.add(id); }
SelectionModule extends AdapterModule { protected final void select(final long id) { if (selection == null) selection = new ArrayList<>(mode == SINGLE ? INITIAL_CAPACITY_SINGLE : INITIAL_CAPACITY_MULTI); if (!selection.contains(id)) selection.add(id); } }
SelectionModule extends AdapterModule { protected final void select(final long id) { if (selection == null) selection = new ArrayList<>(mode == SINGLE ? INITIAL_CAPACITY_SINGLE : INITIAL_CAPACITY_MULTI); if (!selection.contains(id)) selection.add(id); }  }
SelectionModule extends AdapterModule { protected final void select(final long id) { if (selection == null) selection = new ArrayList<>(mode == SINGLE ? INITIAL_CAPACITY_SINGLE : INITIAL_CAPACITY_MULTI); if (!selection.contains(id)) selection.add(id); }  void setMode(@SelectionMode final int mode); @SelectionMode int getMode(); int toggleSelection(final long id); void setSelected(final long id, final boolean selected); void selectAll(); void selectRange(final int startPosition, final int count); void setSelection(@Nullable final List<Long> selection); boolean isSelected(final long id); @NonNull List<Long> getSelection(); int getSelectionSize(); void clearSelection(); void clearSelectionInRange(final int startPosition, final int count); @Override boolean requiresStateSaving(); @Override @CallSuper @NonNull Parcelable saveInstanceState(); @Override @CallSuper void restoreInstanceState(@NonNull final Parcelable savedState); }
SelectionModule extends AdapterModule { protected final void select(final long id) { if (selection == null) selection = new ArrayList<>(mode == SINGLE ? INITIAL_CAPACITY_SINGLE : INITIAL_CAPACITY_MULTI); if (!selection.contains(id)) selection.add(id); }  void setMode(@SelectionMode final int mode); @SelectionMode int getMode(); int toggleSelection(final long id); void setSelected(final long id, final boolean selected); void selectAll(); void selectRange(final int startPosition, final int count); void setSelection(@Nullable final List<Long> selection); boolean isSelected(final long id); @NonNull List<Long> getSelection(); int getSelectionSize(); void clearSelection(); void clearSelectionInRange(final int startPosition, final int count); @Override boolean requiresStateSaving(); @Override @CallSuper @NonNull Parcelable saveInstanceState(); @Override @CallSuper void restoreInstanceState(@NonNull final Parcelable savedState); static final int SINGLE; static final int MULTIPLE; }