Check if all given methods return true or if the list is empty.

@param instance the context object
@param methods the list of method to check

@return true if all method return true or if the list is empty
436860
public static boolean checkAllMethodReturnTrue(final Object instance, final List<Method> methods) {
        boolean res = true;

        if (!methods.isEmpty()) {
            for (final Method method : methods) {
                Object returnValue;
                try {
                    returnValue = method.invoke(instance);
                    res &= returnValue instanceof Boolean && ((Boolean) returnValue).booleanValue();
                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
                    res = false;
                }
            }
        }
        return res;
    }
1338039
private static boolean notFound(Method m, Collection<Method> s) {
      for (Method found : s) {
         if (m.getName().equals(found.getName()) &&
               Arrays.equals(m.getParameterTypes(), found.getParameterTypes()))
            return false;
      }
      return true;
   }
640766
public static boolean isObjectMethod(Method method) {
		if (method == null) {
			return false;
		}
		try {
			Object.class.getDeclaredMethod(method.getName(), method.getParameterTypes());
			return true;
		}
		catch (Exception ex) {
			return false;
		}
	}
1031885
private boolean isEmptyImplementation(MethodGen methodGen){
        boolean invokeInst = false;
        boolean loadField = false;

        for (Iterator itIns = methodGen.getInstructionList().iterator();itIns.hasNext();) {
            Instruction inst = ((InstructionHandle) itIns.next()).getInstruction();
            if (DEBUG)
                System.out.println(inst.toString(true));

            if (inst instanceof InvokeInstruction) {
                invokeInst = true;
            }
            if (inst instanceof GETFIELD) {
                loadField = true;
            }
        }
        return !invokeInst && !loadField;
    }
763039
def method_missing(method, *args, &block)
      super
    rescue NoMethodError
      return regs(method) if self.has_reg?(method)
      return ports(method) if self.has_port?(method)
      if method.to_s =~ /=$/
        define_singleton_method(method) do |val|
          instance_variable_set("@#{method.to_s.sub('=', '')}", val)
        end
      else
        define_singleton_method(method) do
          instance_variable_get("@#{method}")
        end
      end
      send(method, *args, &block)
    end
622249
private static boolean isRunnerMethod(Method method) {
        Class<?>[] parameterTypes = method.getParameterTypes();

        for (Class<?> parameterType : parameterTypes) {
            if (parameterType.isAssignableFrom(TestRunner.class)) {
                return true;
            }
        }

        return false;
    }
333411
public static boolean isBooleanGetterMethod(final Method method) {
        
        final String methodName = method.getName();
        if(!methodName.startsWith("is")) {
            return false;
            
        } else if(methodName.length() <= 2) {
            return false;
        }
        
        if(method.getParameterCount() > 0) {
            return false;
        }
        
        if(!isPrimitiveBoolean(method.getReturnType())) {
            return false;
        }
        
        return true;
    }
866071
def __is_bound_method(method):
    
    if not(hasattr(method, "__func__") and hasattr(method, "__self__")):
        return False

    # Bound methods have a __self__ attribute pointing to the owner instance
    return six.get_method_self(method) is not None
572972
private static boolean hasMethod(JavaClass c, Method candidateMethod) {
		String name = candidateMethod.getName();
		String sig = candidateMethod.getSignature();

		for (Method method : c.getMethods()) {
			if (!method.isStatic() && method.getName().equals(name) && method.getSignature().equals(sig)) {
				return true;
			}
		}

		return false;
	}
371326
def is_classmethod(fn):
    """"""
    # This is True for bound methods
    if not inspect.ismethod(fn):
        return False
    if not hasattr(fn, "__self__"):
        return False
    im_self = fn.__self__
    # This is None for instance methods on classes, but True
    # for instance methods on instances.
    if im_self is None:
        return False
    # This is True for class methods of new- and old-style classes, respectively
    return isinstance(im_self, six.class_types)
8192
def local_methods_matching(name, is_class_method)

      list = case is_class_method
             when nil then  @class_methods + @instance_methods
             when true then @class_methods
             when false then @instance_methods
             else fail "Unknown is_class_method: #{is_class_method.inspect}"
             end

      list.find_all {|m| m.name;  m.name[name]}
    end
274292
def has_class_methods(*class_method_names):
    

    def test(cls):
        if not isinstance(cls, type):
            cls = type(cls)
        for class_method_name in class_method_names:
            try:
                class_method = getattr(cls, class_method_name)
                if class_method.__self__ is not cls:
                    return False
            except AttributeError:
                return False
        return True

    return test
960586
public static boolean isGetterMethod(Method m) {

        String methodName = m.getName();

        if (methodName.equals("getClass")) {
            return false;
        }

        if (!methodName.startsWith(GET_METHOD_PREFIX) && !methodName.startsWith(IS_METHOD_PREFIX)) {
            return false;
        }
        if (m.getParameterCount() > 0) {
            return false;
        }

        return true;
    }
1165941
private static boolean isDesignerMethod(Method method) {
        Class<?>[] parameterTypes = method.getParameterTypes();

        for (Class<?> parameterType : parameterTypes) {
            if (parameterType.isAssignableFrom(TestDesigner.class)) {
                return true;
            }
        }

        return false;
    }
736088
public boolean isAnnotated(ExecutableElement method) {
        List<? extends AnnotationMirror> annotationMirrors = method.getAnnotationMirrors();
        for (AnnotationMirror annotationMirror : annotationMirrors) {
            String typeName = annotationMirror.getAnnotationType().toString();
            if (!AnnotationUtil.INTERNAL_ANNOTATION_NAMES.contains(typeName)) {
                return true;
            }
        }
        return false;
    }
304396
public static Method findMethod(Collection<Method> methods, Method testMethod)
  {
    for (Method method : methods) {
      if (isMatch(method, testMethod))
        return method;
    }
    
    return null;
  }
132837
public static Method[] getAllInstanceMethods(final Class<?> clazz) {
        if (clazz == null) {
            return null;
        }

        List<Method> methods = new ArrayList<Method>();
        for (Method method : clazz.getMethods()) {
            if (!Modifier.isStatic(method.getModifiers())
                    && Modifier.isPublic(method.getModifiers())) {
                methods.add(method);
            }
        }

        return methods.toArray(new Method[methods.size()]);
    }