public static Collection < MatchedMethod > filterByClosestParams ( final Collection < MatchedMethod > possibilities , final int paramsCount ) { Collection < MatchedMethod > res = null ; for ( int i = 0 ; i < paramsCount ; i ++ ) { final Collection < MatchedMethod > filtered = filterByParam ( possibilities , i ) ; if ( res != null ) { if ( filtered . size ( ) < res . size ( ) ) { res = filtered ; } } else { res = filtered ; } } return res ; }
Looks for most specific type for each parameter .