langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java
changeset 22163 3651128c74eb
parent 22159 682da512ec17
child 24221 2376793dd33b
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
    59 public class Group {
    59 public class Group {
    60 
    60 
    61     /**
    61     /**
    62      * Map of regular expressions with the corresponding group name.
    62      * Map of regular expressions with the corresponding group name.
    63      */
    63      */
    64     private Map<String,String> regExpGroupMap = new HashMap<String,String>();
    64     private Map<String,String> regExpGroupMap = new HashMap<>();
    65 
    65 
    66     /**
    66     /**
    67      * List of regular expressions sorted according to the length. Regular
    67      * List of regular expressions sorted according to the length. Regular
    68      * expression with longest length will be first in the sorted order.
    68      * expression with longest length will be first in the sorted order.
    69      */
    69      */
    70     private List<String> sortedRegExpList = new ArrayList<String>();
    70     private List<String> sortedRegExpList = new ArrayList<>();
    71 
    71 
    72     /**
    72     /**
    73      * List of group names in the same order as given on the command line.
    73      * List of group names in the same order as given on the command line.
    74      */
    74      */
    75     private List<String> groupList = new ArrayList<String>();
    75     private List<String> groupList = new ArrayList<>();
    76 
    76 
    77     /**
    77     /**
    78      * Map of non-regular expressions(possible package names) with the
    78      * Map of non-regular expressions(possible package names) with the
    79      * corresponding group name.
    79      * corresponding group name.
    80      */
    80      */
    81     private Map<String,String> pkgNameGroupMap = new HashMap<String,String>();
    81     private Map<String,String> pkgNameGroupMap = new HashMap<>();
    82 
    82 
    83     /**
    83     /**
    84      * The global configuration information for this run.
    84      * The global configuration information for this run.
    85      */
    85      */
    86     private final Configuration configuration;
    86     private final Configuration configuration;
   174      * then all the packages will be grouped under group "Packages".
   174      * then all the packages will be grouped under group "Packages".
   175      *
   175      *
   176      * @param packages Packages specified on the command line.
   176      * @param packages Packages specified on the command line.
   177      */
   177      */
   178     public Map<String,List<PackageDoc>> groupPackages(PackageDoc[] packages) {
   178     public Map<String,List<PackageDoc>> groupPackages(PackageDoc[] packages) {
   179         Map<String,List<PackageDoc>> groupPackageMap = new HashMap<String,List<PackageDoc>>();
   179         Map<String,List<PackageDoc>> groupPackageMap = new HashMap<>();
   180         String defaultGroupName =
   180         String defaultGroupName =
   181             (pkgNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
   181             (pkgNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
   182                 configuration.message.getText("doclet.Packages") :
   182                 configuration.message.getText("doclet.Packages") :
   183                 configuration.message.getText("doclet.Other_Packages");
   183                 configuration.message.getText("doclet.Other_Packages");
   184         // if the user has not used the default group name, add it
   184         // if the user has not used the default group name, add it
   227      * @param groupname Group name to search.
   227      * @param groupname Group name to search.
   228      */
   228      */
   229     List<PackageDoc> getPkgList(Map<String,List<PackageDoc>> map, String groupname) {
   229     List<PackageDoc> getPkgList(Map<String,List<PackageDoc>> map, String groupname) {
   230         List<PackageDoc> list = map.get(groupname);
   230         List<PackageDoc> list = map.get(groupname);
   231         if (list == null) {
   231         if (list == null) {
   232             list = new ArrayList<PackageDoc>();
   232             list = new ArrayList<>();
   233             map.put(groupname, list);
   233             map.put(groupname, list);
   234         }
   234         }
   235         return list;
   235         return list;
   236     }
   236     }
   237 
   237