Comment on How many lines of Java would this take?Comments−ZitchDog16y class ObjectUtil { static boolean hasMethod(Object obj, String... methodNames) { for(String methodName : methodNames) if(!hasMethod(obj, methodName)) return false; return true; } static boolean hasMethod(Object obj, String methodName) { for(Method method : obj.getClass().getMethods()) if(method.getName().equals(methodName)) return true; return false; } }
Comments