@Test public void testIfCanReturnItemCount() { Item item = new Item(); AddAlarmsAdapter addAlarmsAdapter = new AddAlarmsAdapter(asList(item, item, item)); assertThat(addAlarmsAdapter.getItemCount(), equalTo(3)); addAlarmsAdapter = new AddAlarmsAdapter(Collections.singletonList(item)); assertThat(addAlarmsAdapter.getItemCount(), equalTo(1)); List<Item> emptyList = new ArrayList<>(); addAlarmsAdapter = new AddAlarmsAdapter(emptyList); assertThat(addAlarmsAdapter.getItemCount(), equalTo(0)); }
@Override public int getItemCount() { return listItems.size(); }
AddAlarmsAdapter extends RecyclerView.Adapter<AddAlarmsAdapter.ListAdapterHolder> { @Override public int getItemCount() { return listItems.size(); } }
AddAlarmsAdapter extends RecyclerView.Adapter<AddAlarmsAdapter.ListAdapterHolder> { @Override public int getItemCount() { return listItems.size(); } AddAlarmsAdapter(List<Item> listItems); }
AddAlarmsAdapter extends RecyclerView.Adapter<AddAlarmsAdapter.ListAdapterHolder> { @Override public int getItemCount() { return listItems.size(); } AddAlarmsAdapter(List<Item> listItems); @NonNull @Override ListAdapterHolder onCreateViewHolder(@NonNull final ViewGroup viewGroup,
                                                final int index); @Override void onBindViewHolder(@NonNull ListAdapterHolder listAdapterHolder, int position); @Override int getItemCount(); }
AddAlarmsAdapter extends RecyclerView.Adapter<AddAlarmsAdapter.ListAdapterHolder> { @Override public int getItemCount() { return listItems.size(); } AddAlarmsAdapter(List<Item> listItems); @NonNull @Override ListAdapterHolder onCreateViewHolder(@NonNull final ViewGroup viewGroup,
                                                final int index); @Override void onBindViewHolder(@NonNull ListAdapterHolder listAdapterHolder, int position); @Override int getItemCount();  }