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