Method (@NotNull Method sampleMethod, @NotNull Class<?> startFrom, @NotNull Predicate<Method> checker) { String sampleMethodName = sampleMethod.getName(); Class<?>[] sampleMethodParameters = sampleMethod.getParameterCount() == 0 ? ArrayUtil.EMPTY_CLASS_ARRAY : sampleMethod.getParameterTypes(); for (Class<?> superClass : JBIterable.from(JBIterableClassTraverser.classTraverser(startFrom)).append(Object.class).unique()) { for (Method method : superClass.getDeclaredMethods()) { if (sampleMethodName.equals(method.getName()) && method.getParameterCount() == sampleMethodParameters.length && Arrays.equals(method.getParameterTypes(), sampleMethodParameters)) { if (checker.test(method)) { return method; } } } } return null; }