home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / sun / misc / LIFOQueueEnumerator.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  715 b   |  33 lines

  1. package sun.misc;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.NoSuchElementException;
  5.  
  6. final class LIFOQueueEnumerator implements Enumeration {
  7.    Queue queue;
  8.    QueueElement cursor;
  9.  
  10.    LIFOQueueEnumerator(Queue var1) {
  11.       this.queue = var1;
  12.       this.cursor = var1.head;
  13.    }
  14.  
  15.    public boolean hasMoreElements() {
  16.       return this.cursor != null;
  17.    }
  18.  
  19.    public Object nextElement() {
  20.       Queue var1 = this.queue;
  21.       synchronized(var1) {
  22.          if (this.cursor != null) {
  23.             QueueElement var2 = this.cursor;
  24.             this.cursor = this.cursor.next;
  25.             Object var3 = var2.obj;
  26.             return var3;
  27.          }
  28.       }
  29.  
  30.       throw new NoSuchElementException("LIFOQueueEnumerator");
  31.    }
  32. }
  33.