public static final boolean isMoreSpecific ( Class [ ] classes1 , Class [ ] classes2 ) { for ( int index = 0 , count = classes1 . length ; index < count ; ++ index ) { Class c1 = classes1 [ index ] , c2 = classes2 [ index ] ; if ( c1 == c2 ) continue ; else if ( c1 . isPrimitive ( ) ) return true ; else if ( c1 . isAssignableFrom ( c2 ) ) return false ; else if ( c2 . isAssignableFrom ( c1 ) ) return true ; } // They are the same! So the first is not more specific than the second. return false ; }
Tells whether the first array of classes is more specific than the second . Assumes that the two arrays are of the same length .