1 16 19 20 package org.apache.pluto.util; 21 22 import java.util.Collection ; 23 import java.util.Enumeration ; 24 import java.util.Iterator ; 25 import java.util.Map ; 26 import java.util.NoSuchElementException ; 27 28 29 33 34 public final class Enumerator implements Enumeration 35 { 36 37 38 private Iterator iterator = null; 40 41 42 47 public Enumerator(Collection collection) 48 { 49 this(collection.iterator()); 50 } 51 52 53 59 public Enumerator(Iterator iterator) 60 { 61 super(); 62 this.iterator = iterator; 63 } 64 65 66 71 public Enumerator(Map map) 72 { 73 this(map.values().iterator()); 74 } 75 76 77 78 85 public boolean hasMoreElements() 86 { 87 return(iterator.hasNext()); 88 } 89 90 91 98 public Object nextElement() throws NoSuchElementException { 99 return(iterator.next()); 100 } 101 102 103 } 104 | Popular Tags |