package gov.va.med.cds.persistence;

import java.util.Collection;
import java.util.Iterator;

import javax.naming.Binding;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;

public class NamingEnumerationImpl
    implements
        NamingEnumeration<Binding>
{
    private Iterator<Binding> theIterator;
    
    public NamingEnumerationImpl(Collection<Binding> collection )
    {
        this.theIterator = collection.iterator();
    }

    @Override
    public void close( )
        throws NamingException
    {
       
        this.theIterator = null;
    }

    @Override
    public boolean hasMore( )
        throws NamingException
    {
        return this.theIterator.hasNext();
    }

    @Override
    public Binding next( )
        throws NamingException
    {
        return this.theIterator.next();
    }

    @Override
    public boolean hasMoreElements( )
    {
        return this.theIterator.hasNext();
    }

    @Override
    public Binding nextElement( )
    {
        return this.theIterator.next();
    }
}
