Browse Source

use a single empty iterator instead of multiple instances... it's all the same groove, my man...

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@477846 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 18 years ago
parent
commit
63294f1f7b
1 changed files with 13 additions and 11 deletions
  1. +13
    -11
      src/main/org/apache/tools/ant/types/resources/Resources.java

+ 13
- 11
src/main/org/apache/tools/ant/types/resources/Resources.java View File

@@ -45,23 +45,25 @@ public class Resources extends DataType implements ResourceCollection {
return true;
}
public Iterator iterator() {
return new Iterator() {
public Object next() {
throw new NoSuchElementException();
}
public boolean hasNext() {
return false;
}
public void remove() {
throw new UnsupportedOperationException();
}
};
return EMPTY_ITERATOR;
}
public int size() {
return 0;
}
};

private static final Iterator EMPTY_ITERATOR = new Iterator() {
public Object next() {
throw new NoSuchElementException();
}
public boolean hasNext() {
return false;
}
public void remove() {
throw new UnsupportedOperationException();
}
};

private class MyCollection extends AbstractCollection {
private int size;



Loading…
Cancel
Save