code: public static void sortByNumberOfVersionsDesc(List<ClasspathResource> resources) {
          // sort by number of version occurrences
          Comparator<ClasspathResource> sortByNumberOfVersionsDesc = new Comparator<ClasspathResource>() {
              @Override
              public int compare(ClasspathResource resource1, ClasspathResource resource2) {
                  return -1 * new Integer(resource1.getResourceFileVersions().size()).compareTo(resource2.getResourceFileVersions().size());
              }
          };
          Collections.sort(resources, sortByNumberOfVersionsDesc);
      }
docs: Takes a list of classpath resources and sorts them by the number of classpath versions.
  
  The resources with the biggest number of versions will be first on the list.
  
  
  @param resources to be sorted