2021-09-24 00:36:29 -05:00
|
|
|
jdk.imports['java.util.Itr'].load = async () => {
|
2021-09-23 01:41:44 -05:00
|
|
|
class Itr {
|
|
|
|
constructor(list) {
|
|
|
|
this.cursor = 0;
|
|
|
|
this.lastRet = -1;
|
|
|
|
this.list = list;
|
|
|
|
}
|
|
|
|
|
|
|
|
hasNext() {
|
|
|
|
return this.cursor != this.list.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
next() {
|
|
|
|
try {
|
|
|
|
const i = this.cursor;
|
|
|
|
const next = this.list.get(i);
|
|
|
|
this.lastRet = i;
|
|
|
|
this.cursor = i + 1;
|
|
|
|
return next;
|
|
|
|
} catch ($ex$) {
|
|
|
|
if ($ex$ instanceof Error) {
|
|
|
|
const e = $ex$;
|
2021-09-23 23:26:42 -05:00
|
|
|
throw new Error('no such element exception');
|
2021-09-23 01:41:44 -05:00
|
|
|
} else {
|
|
|
|
throw $ex$;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-23 23:26:42 -05:00
|
|
|
jdk.java.util.Itr = Itr;
|
|
|
|
};
|