Polish JarFile to extra anonymous inner class
See gh-20882
This commit is contained in:
committed by
Stephane Nicoll
parent
947594addd
commit
e0d1cf0e38
@@ -192,19 +192,7 @@ public class JarFile extends java.util.jar.JarFile {
|
||||
@Override
|
||||
public Enumeration<java.util.jar.JarEntry> entries() {
|
||||
final Iterator<JarEntry> iterator = this.entries.iterator();
|
||||
return new Enumeration<java.util.jar.JarEntry>() {
|
||||
|
||||
@Override
|
||||
public boolean hasMoreElements() {
|
||||
return iterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.jar.JarEntry nextElement() {
|
||||
return iterator.next();
|
||||
}
|
||||
|
||||
};
|
||||
return new EnumerationJarEntry(iterator);
|
||||
}
|
||||
|
||||
public JarEntry getJarEntry(CharSequence name) {
|
||||
@@ -421,4 +409,33 @@ public class JarFile extends java.util.jar.JarFile {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Enumeration jar entry.
|
||||
*/
|
||||
static class EnumerationJarEntry implements Enumeration<java.util.jar.JarEntry> {
|
||||
|
||||
/**
|
||||
* The Iterator.
|
||||
*/
|
||||
Iterator<JarEntry> iterator;
|
||||
|
||||
/**
|
||||
* Instantiates a new Enumeration jar entry.
|
||||
*
|
||||
* @param iterator the iterator
|
||||
*/
|
||||
EnumerationJarEntry(Iterator<JarEntry> iterator) {
|
||||
this.iterator = iterator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMoreElements() {
|
||||
return this.iterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.jar.JarEntry nextElement() {
|
||||
return this.iterator.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user