Code example for Collection

Methods: iterator

0
	int numberOfCalls;
	 
	public RingIteratorable(Collection<? extends T> collection)
	{ 
		this.collection = collection;
		this.iterator = collection.iterator();
	} 
 
	public RingIteratorable(Collection<? extends T> collection, int stopAfterThisManyCalls)
	{ 
		this.collection = collection;
		this.iterator = collection.iterator();
		this.stopAfterThisManyCalls = stopAfterThisManyCalls;
	} 
	 
	public boolean hasNext() { 
		return (stopAfterThisManyCalls < 0 || numberOfCalls < stopAfterThisManyCalls);
	} 
 
	public T next() { 
		if (stopAfterThisManyCalls >=0)