Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 7 8 package java.util; 9 10 14 class ResourceBundleEnumeration implements Enumeration <String > { 15 16 Set <String > set; 17 Iterator <String > iterator; 18 Enumeration <String > enumeration; 20 26 ResourceBundleEnumeration(Set <String > set, Enumeration <String > enumeration) { 27 this.set = set; 28 this.iterator = set.iterator(); 29 this.enumeration = enumeration; 30 } 31 32 String next = null; 33 34 public boolean hasMoreElements() { 35 if (next == null) { 36 if (iterator.hasNext()) { 37 next = iterator.next(); 38 } else if (enumeration != null) { 39 while (next == null && enumeration.hasMoreElements()) { 40 next = enumeration.nextElement(); 41 if (set.contains(next)) { 42 next = null; 43 } 44 } 45 } 46 } 47 return next != null; 48 } 49 50 public String nextElement() { 51 if (hasMoreElements()) { 52 String result = next; 53 next = null; 54 return result; 55 } else { 56 throw new NoSuchElementException (); 57 } 58 } 59 } 60
| Popular Tags
|