question: @ SuppressWarnings ( "unchecked" ) public static < C extends Result > ArrayList < C > filterResults ( ResultHierarchy hier , Result r , Class < ? super C > restrictionClass ) { ArrayList < C > res = new ArrayList < > ( ) ; if ( restrictionClass . isInstance ( r ) ) { res . add ( ( C ) restrictionClass . cast ( r ) ) ; } for ( Hierarchy . Iter < Result > iter = hier . iterDescendants ( r ) ; iter . valid ( ) ; iter . advance ( ) ) { Result result = iter . get ( ) ; if ( restrictionClass . isInstance ( result ) ) { res . add ( ( C ) restrictionClass . cast ( result ) ) ; } } return res ; }
target:  Return only results of the given restriction class