diff base/src/java/util/Arrays.d @ 85:6be48cf9f95c

Work on databinding
author Frank Benoit <benoit@tionex.de>
date Sat, 18 Apr 2009 13:54:50 +0200
parents fcf926c91ca4
children
line wrap: on
line diff
--- a/base/src/java/util/Arrays.d	Sat Apr 18 09:25:29 2009 +0200
+++ b/base/src/java/util/Arrays.d	Sat Apr 18 13:54:50 2009 +0200
@@ -66,13 +66,23 @@
         tango.core.Array.sort( a, &isLess );
     }
     static List    asList(T)(T[] a) {
-        static assert( is(T==interface) || is(T==class));
-        if( a.length is 0 ) return Collections.EMPTY_LIST;
-        ArrayList res = new ArrayList( a.length );
-        foreach( o; a ){
-            res.add( cast(Object)o);
+        static if( is(T==String)){
+            if( a.length is 0 ) return Collections.EMPTY_LIST;
+            ArrayList res = new ArrayList( a.length );
+            foreach( o; a ){
+                res.add( stringcast(o));
+            }
+            return res;
         }
-        return res;
+        else{
+            static assert( is(T==interface) || is(T==class), "asList");
+            if( a.length is 0 ) return Collections.EMPTY_LIST;
+            ArrayList res = new ArrayList( a.length );
+            foreach( o; a ){
+                res.add( cast(Object)o);
+            }
+            return res;
+        }
     }
     public static void fill( char[] str, char c ){
         str[] = c;