1using System.Collections.Generic;
18 public static IEnumerator<T>
AsEnumerator<T>(
this Iterator iterator) => iterator
switch
20 IEnumerator<T> i => i,
32 var l =
new List<T>();
33 while (iterator.hasNext())
34 l.Add((T)iterator.next());
47 while (iterator.hasNext())
48 yield
return (T)iterator.next();
Provides extension methods for working against Java Iterator instances.
static IEnumerable< T > RemainingToEnumerable< T >(this Iterator iterator)
Returns an enumerable that iterators over the items in an iterator.
static List< T > RemainingToList< T >(this Iterator iterator)
Iterators over the items in an iterator and produces an array.
static IEnumerator< T > AsEnumerator< T >(this Iterator iterator)
Returns the appropriate wrapper type for the given Iterator.