Re: CIAO, How can I sort an ArrayList<K> of Generic Types ?
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 23 May 2008 03:46:09 GMT
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
.
- Follow-Ups:
- References:
- CIAO, How can I sort an ArrayList<K> of Generic Types ?
- From: Giordano
- CIAO, How can I sort an ArrayList<K> of Generic Types ?
- Prev by Date: Re: how can i run perl program from net beans ?
- Next by Date: Re: CIAO, How can I sort an ArrayList<K> of Generic Types ?
- Previous by thread: Re: CIAO, How can I sort an ArrayList<K> of Generic Types ?
- Next by thread: Re: CIAO, How can I sort an ArrayList<K> of Generic Types ?
- Index(es):