code: public static Map<Package, ClassLoader[]> getPackageMap(List<ClassLoader> classLoaders, Set<String> ignorePackages) {
          Map<Package, ClassLoader[]> answer = new HashMap<Package, ClassLoader[]>();
  
          ClassLoader[] globalClassLoaders = {Thread.currentThread().getContextClassLoader(),
                  ClassScanner.class.getClassLoader()};
  
          Set<Package> packages = new HashSet<Package>();
          add(answer, Package.getPackages(), globalClassLoaders, ignorePackages);
  
          ClassLoader[] classLoaderArray = new ClassLoader[classLoaders.size()];
          classLoaders.toArray(classLoaderArray);
  
          for (ClassLoader classLoader : classLoaders) {
              Package[] loaderPackages = findPackagesForClassLoader(classLoader);
              add(answer, loaderPackages, classLoaderArray, ignorePackages);
          }
          SortedSet<String> names = new TreeSet<String>();
          for (Package aPackage : packages) {
              names.add(aPackage.getName());
          }
          for (String name : names) {
              LOG.info("Got package " + name);
          }
          return answer;
      }
docs: /*
  
  public static Map<Package,ClassLoader[]> getPackageSet(List<ClassLoader> classLoaders) {
  Set<Package> packages = new HashSet<Package>();
  add(packages, Package.getPackages());
  for (ClassLoader classLoader : classLoaders) {
  Package[] loaderPackages = findPackagesForClassLoader(classLoader);
  add(packages, loaderPackages);
  }
  SortedSet<String> names = new TreeSet<String>();
  for (Package aPackage : packages) {
  names.add(aPackage.getName());
  }
  for (String name : names) {
  LOG.info("Got package " + name);
  }
  return packages;
  }