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

com.googlecode.objectify.util.TranslatingIterator Maven / Gradle / Ivy

Go to download

*** THIS VERSION UPLOADED FOR USE WITH CEDAR-COMMON, TO AVOID DEPENDENCIES ON GOOGLE CODE-BASED MAVEN REPOSITORIES. *** The simplest convenient interface to the Google App Engine datastore

The newest version!
package com.googlecode.objectify.util;

import java.util.Iterator;

/**
 * Iterator wrapper that translates from one type to another
 *
 * @author Jeff Schnitzer 
 */
abstract public class TranslatingIterator implements Iterator
{
	/** */
	protected Iterator base;
	
	/** */
	public TranslatingIterator(Iterator base) 
	{
		this.base = base;
	}
	
	/**
	 * You implement this - convert from one object to the other
	 */
	abstract protected T translate(F from); 

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

	@Override
	public T next()
	{
		return this.translate(this.base.next());
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy