mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
support ToArray(int[])
This commit is contained in:
parent
283d0d4d7a
commit
5e3dc6d5a0
@ -109,8 +109,10 @@
|
||||
<Return>System.Void</Return>
|
||||
</Method>
|
||||
<Method>
|
||||
<Imports />
|
||||
<Java>${this:16}.toArray(new ${TYPEOF_expr_TYPE}[0])</Java>
|
||||
<Imports>
|
||||
<Import>RusticiSoftware.System.Collections.ArrayListSupport</Import>
|
||||
</Imports>
|
||||
<Java>ArrayListSupport.toArray(${this}, new ${TYPEOF_expr_TYPE}[0])</Java>
|
||||
<Params>
|
||||
<Param>
|
||||
<Type>System.Type</Type>
|
||||
|
@ -84,15 +84,36 @@ public class ArrayListSupport extends AbstractCollection implements List {
|
||||
return (T[]) al.toArray(dummy);
|
||||
}
|
||||
|
||||
public int[] toArrayS(int[] dummy)
|
||||
{
|
||||
int idx = 0;
|
||||
int[] arrayInt = new int[al.size()];
|
||||
for(int v : (ArrayList<Integer>)al)
|
||||
arrayInt[idx++] = v;
|
||||
return arrayInt;
|
||||
}
|
||||
|
||||
public int[] toArrayS(int[] dummy)
|
||||
{
|
||||
int idx = 0;
|
||||
int[] arrayInt = new int[al.size()];
|
||||
for(int v : (ArrayList<Integer>)al)
|
||||
arrayInt[idx++] = v;
|
||||
return arrayInt;
|
||||
}
|
||||
|
||||
// public static Object[] toArray(ArrayList al)
|
||||
// {
|
||||
// int idx = 0;
|
||||
// Object[] arr = new Object[al.size()];
|
||||
// for(Object v : al)
|
||||
// arr[idx++] = v;
|
||||
// return arr;
|
||||
// }
|
||||
public static <T> T[] toArray(ArrayList al, T[] dummy)
|
||||
{
|
||||
return (T[]) al.toArray(dummy);
|
||||
}
|
||||
public static int[] toArray(ArrayList al, int[] dummy)
|
||||
{
|
||||
int idx = 0;
|
||||
int[] arrayInt = new int[al.size()];
|
||||
for(int v : (ArrayList<Integer>)al)
|
||||
arrayInt[idx++] = v;
|
||||
return arrayInt;
|
||||
}
|
||||
|
||||
public Object[] toArray()
|
||||
{
|
||||
return al.toArray();
|
||||
|
Loading…
x
Reference in New Issue
Block a user