package speiger.src.coreengine.utils.collections.iterators;

import java.util.Iterator;
import java.util.List;

public class IndexIterator<T> implements Iterator<T> {
	List<T> list;
	int[] indexes;
	int index = 0;
	
	public IndexIterator(List<T> list, int... indexes) {
		this.list = list;
		this.indexes = indexes;
	}
	
	@Override
	public boolean hasNext() {
		return index < indexes.length;
	}
	
	@Override
	public T next() {
		return list.get(indexes[index++]);
	}
	
}
