how do i set up my next() to overrride the iterator?
cause it looks like it does to me....
import java.util.*;
public class IteratorTest implements Iterator
{
private int[] nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
private int nextNum;
public IteratorTest(){
nextNum = 0;
}
public <E> int next(){
nextNum += 1;
return nums[nextNum-1];
}
public void remove(){
System.out.println("Remove is not allowed");
}
}

New Topic/Question
Reply




MultiQuote





|