code: public void collapse(int position, boolean notifyItemChanged) {
          final int[] expandedItemsCount = {0};
          mFastAdapter.recursive(new AdapterPredicate<Item>() {
              ArraySet<IItem> allowedParents = new ArraySet<>();
  
              @Override
              public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, @NonNull Item item, int position) {
                  //we do not care about non visible items
                  if (position == -1) {
                      return false;
                  }
  
                  //this is the entrance parent
                  if (allowedParents.size() > 0 && item instanceof ISubItem) {
                      // Go on until we hit an item with a parent which was not in our expandable hierarchy
                      IItem parent = ((ISubItem) item).getParent();
                      if (parent == null || !allowedParents.contains(parent)) {
                          return true;
                      }
                  }
  
                  if (item instanceof IExpandable) {
                      IExpandable expandable = (IExpandable) item;
                      if (expandable.isExpanded()) {
                          expandable.withIsExpanded(false);
  
                          if (expandable.getSubItems() != null) {
                              expandedItemsCount[0] += expandable.getSubItems().size();
                              allowedParents.add(item);
                          }
                      }
                  }
  
                  return false;
              }
          }, position, true);
  
          IAdapter adapter = mFastAdapter.getAdapter(position);
          if (adapter != null && adapter instanceof IItemAdapter) {
              ((IItemAdapter) adapter).removeRange(position + 1, expandedItemsCount[0]);
          }
  
          //we need to notify to get the correct drawable if there is one showing the current state
          if (notifyItemChanged) {
              mFastAdapter.notifyItemChanged(position);
          }
      }
docs: collapses (closes) the given collapsible item at the given position
  
  @param position          the global position
  @param notifyItemChanged true if we need to call notifyItemChanged. DEFAULT: false