Re: CIAO, How can I sort an ArrayList<K> of Generic Types ?
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 23 May 2008 02:06:49 GMT
On Wed, 21 May 2008 06:38:06 -0700 (PDT), Giordano
<mejoro82@xxxxxxxxx> wrote, quoted or indirectly quoted someone who
said :
"Ciao" (Hi) to everyone,
please can you tell me how can I sort an ArrayList<K> of generic
types ?
If this arraylist were of this kind, ArrayList<String>, I could sort
it simply using this instruction:
ArrayList<String> list = new ArrayList<String>();
java.util.Collections.sort ( list );
but, in my case, i see that i cannot sort in this same way when i use
an arraylist of generic types.. like this one:
ArrayList<K> list = new ArrayList<K>();
/* ERROR --> */ java.util.Collections.sort ( list );
see http://mindprod.com/jgloss/sort.html
http://mindprod.com/jgloss/comparable.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.
- 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: Hi,Could someone help write a regex parsing sql str for me:)
- 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):
Relevant Pages
|
|