langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/StandardDocFileFactory.java
changeset 22163 3651128c74eb
parent 19667 fdfce85627a9
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
   103     @Override
   103     @Override
   104     Iterable<DocFile> list(Location location, DocPath path) {
   104     Iterable<DocFile> list(Location location, DocPath path) {
   105         if (location != StandardLocation.SOURCE_PATH)
   105         if (location != StandardLocation.SOURCE_PATH)
   106             throw new IllegalArgumentException();
   106             throw new IllegalArgumentException();
   107 
   107 
   108         Set<DocFile> files = new LinkedHashSet<DocFile>();
   108         Set<DocFile> files = new LinkedHashSet<>();
   109         Location l = fileManager.hasLocation(StandardLocation.SOURCE_PATH)
   109         Location l = fileManager.hasLocation(StandardLocation.SOURCE_PATH)
   110                 ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
   110                 ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
   111         for (File f: fileManager.getLocation(l)) {
   111         for (File f: fileManager.getLocation(l)) {
   112             if (f.isDirectory()) {
   112             if (f.isDirectory()) {
   113                 f = new File(f, path.getPath());
   113                 f = new File(f, path.getPath());
   229             }
   229             }
   230         }
   230         }
   231 
   231 
   232         /** If the file is a directory, list its contents. */
   232         /** If the file is a directory, list its contents. */
   233         public Iterable<DocFile> list() {
   233         public Iterable<DocFile> list() {
   234             List<DocFile> files = new ArrayList<DocFile>();
   234             List<DocFile> files = new ArrayList<>();
   235             for (File f: file.listFiles()) {
   235             for (File f: file.listFiles()) {
   236                 files.add(new StandardDocFile(f));
   236                 files.add(new StandardDocFile(f));
   237             }
   237             }
   238             return files;
   238             return files;
   239         }
   239         }