Creates a new ArrayIterator instance
创建一个新的 ArrayIterator 实例
The source array to iterate. 要迭代的源数组
Drops the first N elements
跳过前 N 个元素
The number of elements to drop. 要跳过的元素数量
A new ArrayIterator instance with the drop operation. 带有跳过操作的新 ArrayIterator 实例
Tests whether all elements pass the test implemented by the provided function
测试所有元素是否都通过了由提供的函数实现的测试
The function to test for each element. 用于测试每个元素的函数
true if all elements pass the test, false otherwise. 如果所有元素都通过测试则返回 true,否则返回 false
Filters elements based on a predicate function
根据断言函数过滤元素
The predicate function. 断言函数
A new ArrayIterator instance with the filter operation. 带有过滤操作的新 ArrayIterator 实例
Returns the value of the first element that satisfies the provided testing function
返回满足提供的测试函数的第一个元素的值
The function to test for each element. 用于测试每个元素的函数
The value of the first element that passes the test, or undefined if no element passes. 通过测试的第一个元素的值,如果没有元素通过则返回 undefined
Executes a provided callback function once for each array element
对数组中的每个元素执行一次提供的回调函数
The function to execute for each element. 为每个元素执行的函数
Transforms elements using a transform function
使用转换函数转换元素
The type of transformed elements. 转换后的元素类型
The transform function. 转换函数
A new ArrayIterator instance with the map operation. 带有映射操作的新 ArrayIterator 实例
Tests whether at least one element passes the test implemented by the provided function
测试是否至少有一个元素通过了由提供的函数实现的测试
The function to test for each element. 用于测试每个元素的函数
true if at least one element passes the test, false otherwise. 如果至少有一个元素通过测试则返回 true,否则返回 false
Takes the first N elements
获取前 N 个元素
The maximum number of elements to take. 要获取的最大元素数
A new ArrayIterator instance with the take operation. 带有获取操作的新 ArrayIterator 实例
Executes all chained operations and returns the final result array
执行所有链式操作并返回最终结果数组
An array of the processed elements. 处理后的元素数组
An iterator class for arrays with chainable operations and lazy evaluation
支持链式操作和惰性计算的数组迭代器类
Remarks
Each chained operation (.filter(), .map(), .drop(), .take()) creates a shallow copy of the current operation list (O(k) where k is the number of chained calls). Excessive chaining may cause quadratic overhead. Consider limiting chain depth and combining filter/map logic where possible.
每次链式调用(.filter()、.map()、.drop()、.take())都会浅拷贝当前操作列表(O(k),k 为链式调用次数)。大量链式调用可能产生平方级开销。建议控制链式调用深度,并在可能时合并 filter/map 逻辑。
Example