/** * Removes all empty Structures from a NestedListContainer and all substructures. */ public static NestedListContainer eliminateEmptyStructures( NestedListContainer nlc ){ for(int i=nlc.size()-1; i>=0; i--){ NestedList nl = nlc.getNestedList(i); if( nl.getClass()==NestedListContainer.class ) eliminateEmptyStructures( (NestedListContainer)nl ); if( nl.empty() )nlc.remove( nl ); } return nlc; }