private HashMap<Integer,Boolean> generateExpandedStateMap(){
  HashMap<Integer,Boolean> parentListItemHashMap=new HashMap<>();
  int childCount=0;
  Object listItem;
  ParentWrapper parentWrapper;
  int listItemCount=mItemList.size();
  for (int i=0; i < listItemCount; i++) {
    if (mItemList.get(i) != null) {
      listItem=getListItem(i);
      if (listItem instanceof ParentWrapper) {
        parentWrapper=(ParentWrapper)listItem;
        parentListItemHashMap.put(i - childCount,parentWrapper.isExpanded());
      }
 else {
        childCount++;
      }
    }
  }
  return parentListItemHashMap;
}

private HashMap < Integer , Boolean > generateExpandedStateMap ( ) { HashMap < Integer , Boolean > parentListItemHashMap = new HashMap < > ( ) ; int childCount = 0 ; Object listItem ; ParentWrapper parentWrapper ; int listItemCount = mItemList . size ( ) ; for ( int i = 0 ; i < listItemCount ; i ++ ) { if ( mItemList . get ( i ) != null ) { listItem = getListItem ( i ) ; if ( listItem instanceof ParentWrapper ) { parentWrapper = ( ParentWrapper ) listItem ; parentListItemHashMap . put ( i - childCount , parentWrapper . isExpanded ( ) ) ; } else { childCount ++ ; } } } return parentListItemHashMap ; }
generates a hashmap used to store expanded state for items in the list on configuration change or whenever onresume is called .
