langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java
changeset 42827 36468b5fa7f4
parent 42407 f3702cff2933
--- a/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Fri Dec 16 12:08:46 2016 +0100
+++ b/langtools/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Fri Dec 16 15:27:34 2016 +0000
@@ -147,11 +147,7 @@
     }
 
     public Iterable<ClassFile> getClassFiles() throws IOException {
-        return new Iterable<ClassFile>() {
-            public Iterator<ClassFile> iterator() {
-                return new FileIterator();
-            }
-        };
+        return FileIterator::new;
     }
 
     protected ClassFile readClassFile(Path p) throws IOException {
@@ -232,7 +228,7 @@
         protected Set<String> scan() {
             try (Stream<Path> stream = Files.walk(path, Integer.MAX_VALUE)) {
                 return stream.filter(ClassFileReader::isClass)
-                             .map(f -> path.relativize(f))
+                             .map(path::relativize)
                              .map(Path::toString)
                              .map(p -> p.replace(File.separatorChar, '/'))
                              .collect(Collectors.toSet());
@@ -264,11 +260,7 @@
 
         public Iterable<ClassFile> getClassFiles() throws IOException {
             final Iterator<ClassFile> iter = new DirectoryIterator();
-            return new Iterable<ClassFile>() {
-                public Iterator<ClassFile> iterator() {
-                    return iter;
-                }
-            };
+            return () -> iter;
         }
 
         class DirectoryIterator implements Iterator<ClassFile> {
@@ -387,11 +379,7 @@
 
         public Iterable<ClassFile> getClassFiles() throws IOException {
             final Iterator<ClassFile> iter = new JarFileIterator(this, jarfile);
-            return new Iterable<ClassFile>() {
-                public Iterator<ClassFile> iterator() {
-                    return iter;
-                }
-            };
+            return () -> iter;
         }
     }