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

net.ericaro.neoitertools.generators.GenericArrayGenerator Maven / Gradle / Ivy

The newest version!
package net.ericaro.neoitertools.generators;

import java.util.NoSuchElementException;

import net.ericaro.neoitertools.Generator;

/** A {@link Generator} based on any Object Type array.
 * 
 * @author eric
 *
 * @see GenericArrayGenerator's wiki page
* @see neoitertools site
 */
public class GenericArrayGenerator implements Generator {

	private T[] values;
	private int i;

	public GenericArrayGenerator(T... values) {
		super();
		this.values = values;
		i = 0;
	}

	public T next() throws NoSuchElementException {
		if (i>= values.length) throw new NoSuchElementException();
		return values[i++];
	}
	
	

	
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy