Mercurial > projects > dwt-addons
comparison dwtx/dwtxhelper/Collection.d @ 106:8ab6fb387666
more Collection impl
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 07 Aug 2008 16:03:56 +0200 |
parents | 04b47443bb01 |
children | efda8ce1120b |
comparison
equal
deleted
inserted
replaced
105:2be5f40557e6 | 106:8ab6fb387666 |
---|---|
1974 } | 1974 } |
1975 } | 1975 } |
1976 } | 1976 } |
1977 return EMPTY_LIST_; | 1977 return EMPTY_LIST_; |
1978 } | 1978 } |
1979 private static Map EMPTY_MAP_; | |
1979 public static Map EMPTY_MAP(){ | 1980 public static Map EMPTY_MAP(){ |
1980 implMissing( __FILE__, __LINE__ ); | 1981 if( EMPTY_MAP_ is null ){ |
1981 return null; | 1982 synchronized(Collections.classinfo ){ |
1982 } | 1983 if( EMPTY_MAP_ is null ){ |
1984 EMPTY_MAP_ = new TreeMap(); | |
1985 } | |
1986 } | |
1987 } | |
1988 return EMPTY_MAP_; | |
1989 } | |
1990 private static Set EMPTY_SET_; | |
1983 public static Set EMPTY_SET(){ | 1991 public static Set EMPTY_SET(){ |
1984 implMissing( __FILE__, __LINE__ ); | 1992 if( EMPTY_SET_ is null ){ |
1985 return null; | 1993 synchronized(Collections.classinfo ){ |
1994 if( EMPTY_SET_ is null ){ | |
1995 EMPTY_SET_ = new TreeSet(); | |
1996 } | |
1997 } | |
1998 } | |
1999 return EMPTY_SET_; | |
1986 } | 2000 } |
1987 | 2001 |
1988 public static List unmodifiableList( List list ){ | 2002 public static List unmodifiableList( List list ){ |
1989 implMissing( __FILE__, __LINE__ ); | 2003 implMissing( __FILE__, __LINE__ ); |
1990 return null; | 2004 return null; |
1996 public static Set unmodifiableSet( Set list ){ | 2010 public static Set unmodifiableSet( Set list ){ |
1997 implMissing( __FILE__, __LINE__ ); | 2011 implMissing( __FILE__, __LINE__ ); |
1998 return null; | 2012 return null; |
1999 } | 2013 } |
2000 public static Set singleton( Object o ){ | 2014 public static Set singleton( Object o ){ |
2001 implMissing( __FILE__, __LINE__ ); | 2015 TreeSet res = new TreeSet(); |
2002 return null; | 2016 res.add(o); |
2017 return res; | |
2003 } | 2018 } |
2004 public static void sort(List list){ | 2019 public static void sort(List list){ |
2005 implMissing( __FILE__, __LINE__ ); | 2020 implMissing( __FILE__, __LINE__ ); |
2006 } | 2021 } |
2007 public static void sort(List list, Comparator c){ | 2022 public static void sort(List list, Comparator c){ |
2031 // static SortedSet synchronizedSortedSet(SortedSet s){ | 2046 // static SortedSet synchronizedSortedSet(SortedSet s){ |
2032 // implMissing( __FILE__, __LINE__ ); | 2047 // implMissing( __FILE__, __LINE__ ); |
2033 // return null; | 2048 // return null; |
2034 // } | 2049 // } |
2035 static void reverse(List list) { | 2050 static void reverse(List list) { |
2036 implMissing( __FILE__, __LINE__ ); | 2051 Object[] data = list.toArray(); |
2052 for( int idx = 0; idx < data.length; idx++ ){ | |
2053 list.set( data.length -1 -idx, data[idx] ); | |
2054 } | |
2037 } | 2055 } |
2038 static Enumeration enumeration(Collection c){ | 2056 static Enumeration enumeration(Collection c){ |
2039 implMissing( __FILE__, __LINE__ ); | 2057 implMissing( __FILE__, __LINE__ ); |
2040 return null; | 2058 return null; |
2041 } | 2059 } |