aboutsummaryrefslogtreecommitdiff
path: root/project/QBarInterpreter/src/com/modulus/qbar/lang/QBListIterator.java
blob: 97a4254fbeaa66ec30287e73acb54227dd7837f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.modulus.qbar.lang;

import com.modulus.qbar.core.QBObject;

public class QBListIterator extends QBIterator<QBList> {
	private static final long serialVersionUID = 8306618418948706270L;
	int index = 0;;
	public QBListIterator(QBList lst){
		super(lst);
		
		if(lst == null)
			throw new RuntimeException("How the Hell is this NULL?");
	}
	
	@Override
	public boolean hasNext() {
		QBList iterable = this.getIterable();
		return index < iterable.size();
	}

	@Override
	protected QBObject nextObject() {
		QBList lst = this.getIterable();
		
		QBObject ret = lst.get(index ++);
		
		return ret;
	}

}