home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / util / ResourceBundleEnumeration.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.3 KB  |  47 lines

  1. package sun.util;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.Iterator;
  5. import java.util.NoSuchElementException;
  6. import java.util.Set;
  7.  
  8. public class ResourceBundleEnumeration implements Enumeration<String> {
  9.    Set<String> set;
  10.    Iterator<String> iterator;
  11.    Enumeration<String> enumeration;
  12.    String next = null;
  13.  
  14.    public ResourceBundleEnumeration(Set<String> var1, Enumeration<String> var2) {
  15.       this.set = var1;
  16.       this.iterator = var1.iterator();
  17.       this.enumeration = var2;
  18.    }
  19.  
  20.    public boolean hasMoreElements() {
  21.       if (this.next == null) {
  22.          if (this.iterator.hasNext()) {
  23.             this.next = (String)this.iterator.next();
  24.          } else if (this.enumeration != null) {
  25.             while(this.next == null && this.enumeration.hasMoreElements()) {
  26.                this.next = (String)this.enumeration.nextElement();
  27.                if (this.set.contains(this.next)) {
  28.                   this.next = null;
  29.                }
  30.             }
  31.          }
  32.       }
  33.  
  34.       return this.next != null;
  35.    }
  36.  
  37.    public String nextElement() {
  38.       if (this.hasMoreElements()) {
  39.          String var1 = this.next;
  40.          this.next = null;
  41.          return var1;
  42.       } else {
  43.          throw new NoSuchElementException();
  44.       }
  45.    }
  46. }
  47.