All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.archive.util.iterator.CloseableIteratorWrapper Maven / Gradle / Ivy

The newest version!
package org.archive.util.iterator;

import java.io.IOException;
import java.util.Iterator;

/**
 * Wrap a regular Iterator<S> to create a CloseableIterator<S> where the close() is a no-op
 * @author ilya
 *
 * @param 
 */

public class CloseableIteratorWrapper implements CloseableIterator
{
	protected Iterator iter;
	
	public CloseableIteratorWrapper(Iterator iter)
	{
		this.iter = iter;
	}
	
	@Override
    public boolean hasNext() {
		return this.iter.hasNext();
    }

	@Override
    public S next() {
		return this.iter.next();
    }

	@Override
    public void remove() {
		this.iter.remove();
        
    }

	@Override
    public void close() throws IOException {
        //No Op
    }		
}