protected void collapseParentListItem(ParentWrapper parentWrapper,int parentIndex,boolean collapseTriggeredByListItemClick){
  if (parentWrapper.isExpanded()) {
    parentWrapper.setExpanded(false);
    List<?> childItemList=parentWrapper.getChildItemList();
    if (childItemList != null) {
      int childListItemCount=childItemList.size();
      for (int i=childListItemCount - 1; i >= 0; i--) {
        mItemList.remove(parentIndex + i + 1);
      }
      notifyItemRangeRemoved(parentIndex + 1,childListItemCount);
    }
    if (collapseTriggeredByListItemClick && mExpandCollapseListener != null) {
      int expandedCountBeforePosition=getExpandedItemCount(parentIndex);
      mExpandCollapseListener.onListItemCollapsed(parentIndex - expandedCountBeforePosition);
    }
  }
}

protected void collapseParentListItem ( ParentWrapper parentWrapper , int parentIndex , boolean collapseTriggeredByListItemClick ) { if ( parentWrapper . isExpanded ( ) ) { parentWrapper . setExpanded ( false ) ; List < ? > childItemList = parentWrapper . getChildItemList ( ) ; if ( childItemList != null ) { int childListItemCount = childItemList . size ( ) ; for ( int i = childListItemCount - 1 ; i >= 0 ; i -- ) { mItemList . remove ( parentIndex + i + 1 ) ; } notifyItemRangeRemoved ( parentIndex + 1 , childListItemCount ) ; } if ( collapseTriggeredByListItemClick && mExpandCollapseListener != null ) { int expandedCountBeforePosition = getExpandedItemCount ( parentIndex ) ; mExpandCollapseListener . onListItemCollapsed ( parentIndex - expandedCountBeforePosition ) ; } } }
collapses a specified parent item . calls through to the expandcollapselistener and adds children of the specified parent to the total list of items .
