import { AbstractArrayIterator } from "./AbstractArrayIterator.js";

export class ArrayIteratorSequential extends AbstractArrayIterator {


    __i = 0;


    initialize(data) {
        super.initialize(data);

        this.__i = 0;
    }

    next(result) {
        const data = this.__data;

        const length = data.length;

        if (this.__i >= length) {
            result.value = undefined;
            result.done = true;
        } else {
            result.value = data[this.__i];
            result.done = false;

            this.__i++;
        }
    }
}
