Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.antlr.stringtemplate.language;
 
Iterator for an array so I don't have to copy the array to a List just to make it iteratable.
 
public class ArrayIterator implements Iterator {
Index into the data array
	protected int i = -1;
	protected Object array = null;
Arrays are fixed size; precompute.
	protected int n;
	public ArrayIterator(Object array) {
		this. = array;
		 = Array.getLength(array);
	}
	public boolean hasNext() {
		return (+1)< && >0;
	}
	public Object next() {
		++; // move to next element
		if (  >=  ) {
			throw new NoSuchElementException();
		}
		return Array.get();
	}
	public void remove() {
	}
New to GrepCode? Check out our FAQ X