IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
EnumerationExtensions.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2
3namespace java.util
4{
5
9 public static class EnumerationExtensions
10 {
11
18 public static IEnumerator<T> AsEnumerator<T>(this Enumeration enumeration) => enumeration switch
19 {
20 IEnumerator<T> i => i,
21 Enumeration i => new EnumerationWrapper<T>(i),
22 };
23
30 public static IEnumerable<T> AsEnumerable<T>(this Enumeration enumeration)
31 {
32 var e = enumeration.AsEnumerator<T>();
33 while (e.MoveNext())
34 yield return e.Current;
35 }
36
37 }
38
39}
Provides extension methods for working against Java Enumeration instances.
static IEnumerable< T > AsEnumerable< T >(this Enumeration enumeration)
Returns the appropriate wrapper type for the given Enumeration.
static IEnumerator< T > AsEnumerator< T >(this Enumeration enumeration)
Returns the appropriate wrapper type for the given Enumeration.