1.1 --- a/rt/emul/compact/src/main/java/java/util/PropertyResourceBundle.java Thu Oct 03 15:40:35 2013 +0200
1.2 +++ b/rt/emul/compact/src/main/java/java/util/PropertyResourceBundle.java Thu Oct 03 17:36:44 2013 +0200
1.3 @@ -42,7 +42,6 @@
1.4 import java.io.InputStream;
1.5 import java.io.Reader;
1.6 import java.io.IOException;
1.7 -import sun.util.ResourceBundleEnumeration;
1.8
1.9 /**
1.10 * <code>PropertyResourceBundle</code> is a concrete subclass of
1.11 @@ -187,4 +186,57 @@
1.12 // ==================privates====================
1.13
1.14 private Map<String,Object> lookup;
1.15 +
1.16 +
1.17 + /**
1.18 + * Implements an Enumeration that combines elements from a Set and
1.19 + * an Enumeration. Used by ListResourceBundle and PropertyResourceBundle.
1.20 + */
1.21 + static class ResourceBundleEnumeration implements Enumeration<String> {
1.22 +
1.23 + Set<String> set;
1.24 + Iterator<String> iterator;
1.25 + Enumeration<String> enumeration; // may remain null
1.26 +
1.27 + /**
1.28 + * Constructs a resource bundle enumeration.
1.29 + * @param set an set providing some elements of the enumeration
1.30 + * @param enumeration an enumeration providing more elements of the enumeration.
1.31 + * enumeration may be null.
1.32 + */
1.33 + public ResourceBundleEnumeration(Set<String> set, Enumeration<String> enumeration) {
1.34 + this.set = set;
1.35 + this.iterator = set.iterator();
1.36 + this.enumeration = enumeration;
1.37 + }
1.38 +
1.39 + String next = null;
1.40 +
1.41 + public boolean hasMoreElements() {
1.42 + if (next == null) {
1.43 + if (iterator.hasNext()) {
1.44 + next = iterator.next();
1.45 + } else if (enumeration != null) {
1.46 + while (next == null && enumeration.hasMoreElements()) {
1.47 + next = enumeration.nextElement();
1.48 + if (set.contains(next)) {
1.49 + next = null;
1.50 + }
1.51 + }
1.52 + }
1.53 + }
1.54 + return next != null;
1.55 + }
1.56 +
1.57 + public String nextElement() {
1.58 + if (hasMoreElements()) {
1.59 + String result = next;
1.60 + next = null;
1.61 + return result;
1.62 + } else {
1.63 + throw new NoSuchElementException();
1.64 + }
1.65 + }
1.66 + }
1.67 +
1.68 }