if (parent == null) {
return getLocalKeys();
}
return new Enumeration<String>() {
Enumeration<String> local = getLocalKeys();
Enumeration<String> pEnum = parent.getKeys();
String nextElement;
private boolean findNext() {
if (nextElement != null) {
return true;
}
while (pEnum.hasMoreElements()) {
String next = pEnum.nextElement();
if (!resources.containsKey(next)) {
nextElement = next;
return true;
}
}
return false;
}
public boolean hasMoreElements() {
if (local.hasMoreElements()) {
return true;
}
return findNext();
}
public String nextElement() {
if (local.hasMoreElements()) {
return local.nextElement();
}
if (findNext()) {
String result = nextElement;
nextElement = null;
return result;
}
// Cause an exception
return pEnum.nextElement();
}
};