public static SortedMap<PackageDoc, SortedSet<ClassDoc>> sortClassesPerPackage(final ClassDoc... classDocs) {

        final SortedMap<PackageDoc, SortedSet<ClassDoc>> toReturn = new TreeMap<>(Comparators.PACKAGE_NAME_COMPARATOR);

        if (classDocs != null) {

            Arrays.stream(classDocs).forEach(current -> {

                // Retrieve (or create) the SortedSet of ClassDocs for the current PackageDocs.
                final SortedSet<ClassDoc> classDocsForCurrentPackage = toReturn.computeIfAbsent(
                        current.containingPackage(),
                        k -> new TreeSet<>(Comparators.CLASS_NAME_COMPARATOR));

                // Add the current ClassDoc to the SortedSet.
                classDocsForCurrentPackage.add(current);
            });
        }

        // All Done.
        return toReturn;
    }
public static SortedMap<PackageDoc, SortedSet<ClassDoc>> sortClassesPerPackage(final ClassDoc... classDocs) {

        final SortedMap<PackageDoc, SortedSet<ClassDoc>> toReturn = new TreeMap<>(Comparators.PACKAGE_NAME_COMPARATOR);

        if (classDocs != null) {

            Arrays.stream(classDocs).forEach(current -> {

                
                final SortedSet<ClassDoc> classDocsForCurrentPackage = toReturn.computeIfAbsent(
                        current.containingPackage(),
                        k -> new TreeSet<>(Comparators.CLASS_NAME_COMPARATOR));

                
                classDocsForCurrentPackage.add(current);
            });
        }

        
        return toReturn;
    }
public static SortedMap < PackageDoc , SortedSet < ClassDoc > > sortClassesPerPackage ( final ClassDoc ... classDocs ) { final SortedMap < PackageDoc , SortedSet < ClassDoc > > toReturn = new TreeMap <> ( Comparators . PACKAGE_NAME_COMPARATOR ) ; if ( classDocs != null ) { Arrays . stream ( classDocs ) . forEach ( current -> { // Retrieve (or create) the SortedSet of ClassDocs for the current PackageDocs. final SortedSet < ClassDoc > classDocsForCurrentPackage = toReturn . computeIfAbsent ( current . containingPackage ( ) , k -> new TreeSet <> ( Comparators . CLASS_NAME_COMPARATOR ) ) ; // Add the current ClassDoc to the SortedSet. classDocsForCurrentPackage . add ( current ) ; } ) ; } // All Done. return toReturn ; }
Sorts all given ClassDocs into a SortedMap keyed by their respective PackageDocs.

@param classDocs an array of ClassDoc objects.
@return A SortedMap relating all ClassDocs to their respective PackageDoc.
Sorts all given ClassDocs into a SortedMap keyed by their respective PackageDocs .