forked from smx-smx/JavaToCSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIKVMHelpers.cs
More file actions
44 lines (36 loc) · 1005 Bytes
/
Copy pathIKVMHelpers.cs
File metadata and controls
44 lines (36 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Collections.Generic;
using java.util;
namespace JavaToCSharp
{
public static class IKVMHelpers
{
public static List<T> ToList<T>(this java.util.List list)
{
if (list == null)
return null;
var newList = new List<T>();
for (int i = 0; i < list.size(); i++)
{
newList.Add((T)list.get(i));
}
return newList;
}
public static IEnumerable<T> AsEnumerable<T>(this java.util.List list)
{
if (list == null)
yield break;
for (int i = 0; i < list.size(); i++)
{
yield return (T)list.get(i);
}
}
public static bool HasFlag(this int value, int flag)
{
return (value & flag) != 0;
}
public static bool HasFlag<T>(this EnumSet values, T flag)
{
return values.contains(flag);
}
}
}