Re: CIAO, How can I sort an ArrayList<K> of Generic Types ?



On Wed, 21 May 2008 06:38:06 -0700 (PDT), Giordano
<mejoro82@xxxxxxxxx> wrote, quoted or indirectly quoted someone who
said :

ArrayList<K> list = new ArrayList<K>();
/* ERROR --> */ java.util.Collections.sort ( list );

hint. Look at the Javadoc for Collections.sort.

It says:

public static <T extends Comparable<? super T>> void sort(List<T>
list)

In other words T had bloody well better implement Comparable in a
generic way.

--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.