From 5e3dc6d5a0cd4d3b82915b7168fd704451b0aacb Mon Sep 17 00:00:00 2001 From: Kevin Glynn Date: Thu, 3 Feb 2011 14:16:29 +0100 Subject: [PATCH] support ToArray(int[]) --- .../System/Collections/ArrayList.xml | 6 ++- .../System/Collections/ArrayListSupport.java | 39 ++++++++++++++----- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/CS2JLibrary/NetFramework/System/Collections/ArrayList.xml b/CS2JLibrary/NetFramework/System/Collections/ArrayList.xml index a066520..ab16013 100644 --- a/CS2JLibrary/NetFramework/System/Collections/ArrayList.xml +++ b/CS2JLibrary/NetFramework/System/Collections/ArrayList.xml @@ -109,8 +109,10 @@ System.Void - - ${this:16}.toArray(new ${TYPEOF_expr_TYPE}[0]) + + RusticiSoftware.System.Collections.ArrayListSupport + + ArrayListSupport.toArray(${this}, new ${TYPEOF_expr_TYPE}[0]) System.Type diff --git a/CS2JLibrary/src/RusticiSoftware/System/Collections/ArrayListSupport.java b/CS2JLibrary/src/RusticiSoftware/System/Collections/ArrayListSupport.java index 91f61fa..806ad69 100755 --- a/CS2JLibrary/src/RusticiSoftware/System/Collections/ArrayListSupport.java +++ b/CS2JLibrary/src/RusticiSoftware/System/Collections/ArrayListSupport.java @@ -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)al) - arrayInt[idx++] = v; - return arrayInt; - } - + public int[] toArrayS(int[] dummy) + { + int idx = 0; + int[] arrayInt = new int[al.size()]; + for(int v : (ArrayList)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[] 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)al) + arrayInt[idx++] = v; + return arrayInt; + } + public Object[] toArray() { return al.toArray();