1 17 package org.apache.ldap.server.db; 18 19 20 import javax.naming.NamingEnumeration ; 21 import java.util.Iterator ; 22 23 24 36 public class TupleEnumeration 37 implements NamingEnumeration 38 { 39 40 private final Object key; 41 42 private final Iterator iterator; 43 44 private final Tuple tuple = new Tuple(); 45 46 47 53 public TupleEnumeration( Object key, Iterator iterator ) 54 { 55 this.key = key; 56 tuple.setKey( key ); 57 this.iterator = iterator; 58 } 59 60 61 66 public Object next() 67 { 68 tuple.setKey( key ); 69 tuple.setValue( iterator.next() ); 70 return tuple; 71 } 72 73 74 79 public Object nextElement() 80 { 81 tuple.setKey( key ); 82 tuple.setValue( iterator.next() ); 83 return tuple; 84 } 85 86 87 92 public boolean hasMore() 93 { 94 return iterator.hasNext(); 95 } 96 97 98 103 public boolean hasMoreElements() 104 { 105 return iterator.hasNext(); 106 } 107 108 109 112 public void close() 113 { 114 } 115 } 116 | Popular Tags |