code: @Override
      @SuppressWarnings("unchecked")
      @UiThread
      public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int flatPosition) {
          if (flatPosition > mFlatItemList.size()) {
              throw new IllegalStateException("Trying to bind item out of bounds, size " + mFlatItemList.size()
                      + " flatPosition " + flatPosition + ". Was the data changed without a call to notify...()?");
          }
  
          ExpandableWrapper<P, C> listItem = mFlatItemList.get(flatPosition);
          if (listItem.isParent()) {
              PVH parentViewHolder = (PVH) holder;
  
              if (parentViewHolder.shouldItemViewClickToggleExpansion()) {
                  parentViewHolder.setMainItemClickToExpand();
              }
  
              parentViewHolder.setExpanded(listItem.isExpanded());
              parentViewHolder.mParent = listItem.getParent();
              onBindParentViewHolder(parentViewHolder, getNearestParentPosition(flatPosition), listItem.getParent());
          } else {
              CVH childViewHolder = (CVH) holder;
              childViewHolder.mChild = listItem.getChild();
              onBindChildViewHolder(childViewHolder, getNearestParentPosition(flatPosition), getChildPosition(flatPosition), listItem.getChild());
          }
      }
docs: Implementation of Adapter.onBindViewHolder(RecyclerView.ViewHolder, int)
  that determines if the list item is a parent or a child and calls through
  to the appropriate implementation of either
  {@link #onBindParentViewHolder(ParentViewHolder, int, Parent)} or
  {@link #onBindChildViewHolder(ChildViewHolder, int, int, Object)}.
  
  @param holder The RecyclerView.ViewHolder to bind data to
  @param flatPosition The index in the merged list of children and parents at which to bind