@ SuppressWarnings ( "unchecked" ) public static < Item extends IItem > Triple < Boolean , Item , Integer > recursiveSub ( IAdapter < Item > lastParentAdapter , int lastParentPosition , IExpandable parent , AdapterPredicate < Item > predicate , boolean stopOnMatch ) { //in case it's expanded it can be selected via the normal way if ( ! parent . isExpanded ( ) && parent . getSubItems ( ) != null ) { for ( int ii = 0 ; ii < parent . getSubItems ( ) . size ( ) ; ii ++ ) { Item sub = ( Item ) parent . getSubItems ( ) . get ( ii ) ; if ( predicate . apply ( lastParentAdapter , lastParentPosition , sub , - 1 ) && stopOnMatch ) { return new Triple <> ( true , sub , null ) ; } if ( sub instanceof IExpandable ) { Triple < Boolean , Item , Integer > res = FastAdapter . recursiveSub ( lastParentAdapter , lastParentPosition , ( IExpandable ) sub , predicate , stopOnMatch ) ; if ( res . first ) { return res ; } } } } return new Triple <> ( false , null , null ) ; }
Util function which recursively iterates over all items of a IExpandable parent if and only if it is expanded and has subItems This is usually only used in