static boolean areAllArgumentsOfSameType ( Object [ ] arguments ) { if ( arguments == null || arguments . length <= 1 ) { return true ; } // Handle null values int index = 0 ; Object object = null ; while ( object == null && index < arguments . length ) { object = arguments [ index ++ ] ; } if ( object == null ) { return true ; } // End of handling null values final Class < ? > firstArgumentType = getType ( object ) ; for ( int i = index ; i < arguments . length ; i ++ ) { final Object argument = arguments [ i ] ; if ( argument != null && ! getType ( argument ) . isAssignableFrom ( firstArgumentType ) ) { return false ; } } return true ; }
Check if all arguments are of the same type .