diff -r 588d5bf7a560 -r c794024954b5 rt/emul/compact/src/main/java/java/util/PropertyResourceBundle.java --- a/rt/emul/compact/src/main/java/java/util/PropertyResourceBundle.java Thu Oct 03 15:40:35 2013 +0200 +++ b/rt/emul/compact/src/main/java/java/util/PropertyResourceBundle.java Thu Oct 03 17:36:44 2013 +0200 @@ -42,7 +42,6 @@ import java.io.InputStream; import java.io.Reader; import java.io.IOException; -import sun.util.ResourceBundleEnumeration; /** * PropertyResourceBundle is a concrete subclass of @@ -187,4 +186,57 @@ // ==================privates==================== private Map lookup; + + + /** + * Implements an Enumeration that combines elements from a Set and + * an Enumeration. Used by ListResourceBundle and PropertyResourceBundle. + */ + static class ResourceBundleEnumeration implements Enumeration { + + Set set; + Iterator iterator; + Enumeration enumeration; // may remain null + + /** + * Constructs a resource bundle enumeration. + * @param set an set providing some elements of the enumeration + * @param enumeration an enumeration providing more elements of the enumeration. + * enumeration may be null. + */ + public ResourceBundleEnumeration(Set set, Enumeration enumeration) { + this.set = set; + this.iterator = set.iterator(); + this.enumeration = enumeration; + } + + String next = null; + + public boolean hasMoreElements() { + if (next == null) { + if (iterator.hasNext()) { + next = iterator.next(); + } else if (enumeration != null) { + while (next == null && enumeration.hasMoreElements()) { + next = enumeration.nextElement(); + if (set.contains(next)) { + next = null; + } + } + } + } + return next != null; + } + + public String nextElement() { + if (hasMoreElements()) { + String result = next; + next = null; + return result; + } else { + throw new NoSuchElementException(); + } + } + } + }