# HG changeset patch # User Frank Benoit # Date 1218117836 -7200 # Node ID 8ab6fb3876669f4a07b385eb4ab6d8d42e9ec77e # Parent 2be5f40557e62752c7e8c4be757c0a6eace0dc81 more Collection impl diff -r 2be5f40557e6 -r 8ab6fb387666 dwtx/dwtxhelper/Collection.d --- a/dwtx/dwtxhelper/Collection.d Thu Aug 07 16:03:20 2008 +0200 +++ b/dwtx/dwtxhelper/Collection.d Thu Aug 07 16:03:56 2008 +0200 @@ -1976,13 +1976,27 @@ } return EMPTY_LIST_; } + private static Map EMPTY_MAP_; public static Map EMPTY_MAP(){ - implMissing( __FILE__, __LINE__ ); - return null; + if( EMPTY_MAP_ is null ){ + synchronized(Collections.classinfo ){ + if( EMPTY_MAP_ is null ){ + EMPTY_MAP_ = new TreeMap(); + } + } + } + return EMPTY_MAP_; } + private static Set EMPTY_SET_; public static Set EMPTY_SET(){ - implMissing( __FILE__, __LINE__ ); - return null; + if( EMPTY_SET_ is null ){ + synchronized(Collections.classinfo ){ + if( EMPTY_SET_ is null ){ + EMPTY_SET_ = new TreeSet(); + } + } + } + return EMPTY_SET_; } public static List unmodifiableList( List list ){ @@ -1998,8 +2012,9 @@ return null; } public static Set singleton( Object o ){ - implMissing( __FILE__, __LINE__ ); - return null; + TreeSet res = new TreeSet(); + res.add(o); + return res; } public static void sort(List list){ implMissing( __FILE__, __LINE__ ); @@ -2033,7 +2048,10 @@ // return null; // } static void reverse(List list) { - implMissing( __FILE__, __LINE__ ); + Object[] data = list.toArray(); + for( int idx = 0; idx < data.length; idx++ ){ + list.set( data.length -1 -idx, data[idx] ); + } } static Enumeration enumeration(Collection c){ implMissing( __FILE__, __LINE__ );