code: private Set<Method> collectOverloadedMethods(JavaClass cls) {
  
          Set<Method> overloads = new HashSet<>();
  
          Method[] methods = cls.getMethods();
          int numMethods = methods.length;
  
          for (int i = 0; i < numMethods; i++) {
              boolean foundOverload = false;
  
              for (int j = i + 1; j < numMethods; j++) {
  
                  if (methods[i].getName().equals(methods[j].getName())) {
                      overloads.add(methods[j]);
                      foundOverload = true;
                  }
              }
              if (foundOverload) {
                  overloads.add(methods[i]);
              }
          }
  
          return overloads;
      }
docs: adds all methods of a class that are overloaded to a set. This method is O(nlogn) so for large classes might be slow. Assuming on average it's better
  than other choices. When a match is found in the j index, it is removed from the array, so it is not scanned with the i index
  
  @param cls
  the class to look for overloaded methods
  @return the set of methods that are overloaded