* 映射集合中的所有元素 * * @param callback 映射回调函数 * @returns 映射后的新数组
(callback: (item: T, index: number) => U)
| 151 | * @returns 映射后的新数组 |
| 152 | */ |
| 153 | public map<U>(callback: (item: T, index: number) => U): U[] { |
| 154 | const result: U[] = []; |
| 155 | for (let i = 0; i < this._dense.length; i++) { |
| 156 | result.push(callback(this._dense[i]!, i)); |
| 157 | } |
| 158 | return result; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * 过滤集合中的元素 |
no test coverage detected