2022-12-17 15:19:42 -05:00
|
|
|
package funkin.util.tools;
|
2022-03-13 14:36:03 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A static extension which provides utility functions for Iterators.
|
2023-06-08 16:30:45 -04:00
|
|
|
*
|
2022-03-13 14:36:03 -04:00
|
|
|
* For example, add `using IteratorTools` then call `iterator.array()`.
|
2023-06-08 16:30:45 -04:00
|
|
|
*
|
2022-03-13 14:36:03 -04:00
|
|
|
* @see https://haxe.org/manual/lf-static-extension.html
|
|
|
|
*/
|
|
|
|
class IteratorTools
|
|
|
|
{
|
2023-01-22 22:25:45 -05:00
|
|
|
public static function array<T>(iterator:Iterator<T>):Array<T>
|
|
|
|
{
|
|
|
|
return [for (i in iterator) i];
|
|
|
|
}
|
2022-03-13 14:36:03 -04:00
|
|
|
}
|