class MethodUtils {

  public static List<Method> findSwaggerMethods(Class<?> cls) {
    Method[] methods = cls.getMethods();
    List<Method> result = new ArrayList<>(methods.length);

    for (Method m : methods) {
      if (!isSkipMethod(cls, m)) {
        result.add(m);
      }
    }

    // order of cls.getMethods() is undefined and not stable
    // so we must sort them first to make generation is stable
    result.sort(Comparator.comparing(MethodUtils::findSwaggerMethodName));
    return result;
  }

}