code: @UiThread
      private void updateCollapsedParent(@NonNull ExpandableWrapper<P, C> parentWrapper, int flatParentPosition, boolean collapseTriggeredByListItemClick) {
          if (!parentWrapper.isExpanded()) {
              return;
          }
  
          parentWrapper.setExpanded(false);
          mExpansionStateMap.put(parentWrapper.getParent(), false);
  
          List<ExpandableWrapper<P, C>> wrappedChildList = parentWrapper.getWrappedChildList();
          if (wrappedChildList != null) {
              int childCount = wrappedChildList.size();
              for (int i = childCount - 1; i >= 0; i--) {
                  mFlatItemList.remove(flatParentPosition + i + 1);
              }
  
              notifyItemRangeRemoved(flatParentPosition + 1, childCount);
          }
  
          if (collapseTriggeredByListItemClick && mExpandCollapseListener != null) {
              mExpandCollapseListener.onParentCollapsed(getNearestParentPosition(flatParentPosition));
          }
      }
docs: Collapses a specified parent item. Calls through to the
  ExpandCollapseListener and removes children of the specified parent from the
  flat list of items.
  
  @param parentWrapper The ExpandableWrapper of the parent to collapse
  @param flatParentPosition The index of the parent to collapse
  @param collapseTriggeredByListItemClick true if expansion was triggered
  by a click event, false otherwise.