"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cast_de_nrw_schule_svws_core_adt_map_AVLMapSubCollectionIterator = exports.AVLMapSubCollectionIterator = void 0;
const JavaObject_1 = require("../../../java/lang/JavaObject");
const IllegalStateException_1 = require("../../../java/lang/IllegalStateException");
const NoSuchElementException_1 = require("../../../java/util/NoSuchElementException");
class AVLMapSubCollectionIterator extends JavaObject_1.JavaObject {
    _sub;
    _current = null;
    _next = null;
    /**
     * Erstellt einen neuen VALUES-Iterator, welcher auf der {@link AVLMapSubMap} operiert.
     *
     * @param sub Die {@link AVLMapSubMap} auf der dieser Iterator operiert.
     */
    constructor(sub) {
        super();
        this._sub = sub;
        this._current = null;
        this._next = this._sub.firstEntryAsNode();
    }
    next() {
        if (this._next === null)
            throw new NoSuchElementException_1.NoSuchElementException();
        this._current = this._next;
        this._next = this._sub.nextEntryOrNull(this._current);
        return this._current._val;
    }
    hasNext() {
        return this._next !== null;
    }
    remove() {
        if (this._current === null)
            throw new IllegalStateException_1.IllegalStateException();
        this._sub.remove(this._current.getKey());
        this._current = null;
    }
    isTranspiledInstanceOf(name) {
        return ['java.util.Iterator', 'de.nrw.schule.svws.core.adt.map.AVLMapSubCollectionIterator'].includes(name);
    }
}
exports.AVLMapSubCollectionIterator = AVLMapSubCollectionIterator;
function cast_de_nrw_schule_svws_core_adt_map_AVLMapSubCollectionIterator(obj) {
    return obj;
}
exports.cast_de_nrw_schule_svws_core_adt_map_AVLMapSubCollectionIterator = cast_de_nrw_schule_svws_core_adt_map_AVLMapSubCollectionIterator;
//# sourceMappingURL=AVLMapSubCollectionIterator.js.map