[Nice-commit] Nice/stdlib/nice/lang collections.nice,1.66,1.67
Brought to you by:
bonniot
From: Bryn K. <xo...@us...> - 2004-05-26 22:12:57
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5957/stdlib/nice/lang Modified Files: collections.nice Log Message: Added variant of List.sort that works with Comparable elements only, using the Comparable comparison functions. Index: collections.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/collections.nice,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** collections.nice 24 May 2004 18:47:02 -0000 1.66 --- collections.nice 26 May 2004 22:12:46 -0000 1.67 *************** *** 180,183 **** --- 180,191 ---- } + /** + * Uses the default comparison methods defined in Comparable to sort + * the list. + */ + <Comparable T> void sort(List<T> list) { + sort(list, (T t1,T t2)=> t1 < t2 ? -1 : (t1 > t2 ? 1 : 0)); + } + class NiceComparator<-T> implements java.util.Comparator<T> { |