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

com.softicar.platform.common.container.tuple.TupleIterator Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.container.tuple;

import java.util.Iterator;

/**
 * Iterator over the elements of a tuple.
 * 
 * @author Oliver Richers
 */
public class TupleIterator implements Iterator {

	private final AbstractTuple tuple;
	private int index;

	public TupleIterator(AbstractTuple tuple) {

		this.tuple = tuple;
		this.index = 0;
	}

	@Override
	public boolean hasNext() {

		return index < tuple.size();
	}

	@Override
	public Object next() {

		return tuple.get(index++);
	}

	@Override
	public void remove() {

		throw new UnsupportedOperationException("You can't remove elements from a tuple.");
	}
}