1 22 package org.objectweb.petals.util.mock; 23 24 import java.util.Arrays ; 25 import java.util.Enumeration ; 26 import java.util.Iterator ; 27 28 import javax.naming.NamingEnumeration ; 29 import javax.naming.NamingException ; 30 31 36 public class NamingEnumerationImpl<T> implements NamingEnumeration <T> { 37 38 41 protected Iterator <T> iterator; 42 43 public NamingEnumerationImpl(T[] array) { 44 super(); 45 iterator = Arrays.asList(array).iterator(); 46 } 47 48 51 public void close() throws NamingException { 52 iterator = null; 53 } 54 55 58 public boolean hasMore() throws NamingException { 59 return iterator.hasNext(); 60 } 61 62 65 public boolean hasMoreElements() { 66 return iterator.hasNext(); 67 } 68 69 72 public T next() throws NamingException { 73 return iterator.next(); 74 } 75 76 79 public T nextElement() { 80 return iterator.next(); 81 } 82 83 } 84 | Popular Tags |