class_name ListIterator extends Iterator

var _value: Variant
var _iter: RangeIterator

func _init(value: Variant, iter: RangeIterator) -> void:
    _value = value
    _iter = iter

func _at(index: int) -> Variant:
    return _value[index]

func clone() -> ListIterator:
    return ListIterator.new(_value, _iter.clone())

func next() -> Option:
    return _iter.next().map(_at)
